Explanation : Program P( )
{
x = 10;
y = 3;
funb (y, x, x)
print x;
print y;
}
funb (x, y, z)
{
y = y + 4;
z = x + y + z;
}
Since, It is call by reference then address will be pass as argument:
i.e. P( )
{
x = 10;
y = 3;
funb (&y, &x, &x)
print x;
print y;
}
funb (x, y, z) //funb (&y, &x, &x) //
{
y = y + 4; //at &x 14 will be assigned //
z = x + y + z; // Now &x will be assigned with 3 + 14 + 14 = 31.
}
There is no change in y and x is updated twice when printf called it will print x = 31 and y = 3.
So, option (B) is correct.
Explanation : Given, L = L = {anbm | n + m is even}
For (n + m) to be even either n and m both are even or n and m both are odd.
So, for n and m to be even, grammar is;
S1 → aa S1| A1
A1 → bb A1| λ
For n and m odd, grammar is:
S2 → aaS2| aA2
A2 → bbA2| b
Now, combine both; then resultant grammar is:
S → S1 | S2
S1 → aa S1| A1
S2 → aaS2| aA2
A1 → bb A1| λ
A2 → bb A2| b
Explanation : Strings generated by language L = {aa, bb} will be even length. So, complement will be universal set of stringgs - {aa, bb}. i.e. {λ, a, b, ab, ba} and strings {w ∈ {a, b}* | |w| ≥ 3}, i.e. strings of length greater than or equal to 3. So, option (D) is correct.
(r + s)* will generate any strings containing r or s or both. We can draw DFA for (r + s)* and it is same as (s + r)*. It is a regular expression.
(r*)* will generate any sring containing r and its DFA can be drawn easily and it is same as r*. It is also a regular expression.
(r* s*)* will generate any strings containing r or s or both. We can draw DFA for (r* s*)* and it is same as (r + s)*. It is a regular expression. All option are true.
Explanation : It is given that transmission rate of a channel is 32 kbps and ‘8’ routes from source to destination and each packet p contains 8000 bits. Total delay = routes * packets / transmission rate. i.e. 8 * 8000 b / 32 kbps = 8 * 8000 b / 32000 bps = 2 s So, option (A) is correct.