- Option : B
- 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.

You must be logged in to post a comment.

22. The regular grammar for the language L = {a^{n}b^{m} | n + m is even} is given by

- A
S → S

_{1}| S_{2}

S_{1}→ a S_{1}| A_{1}

A_{1}→ b A_{1}| λ

S_{2}→ aaS_{2}| A_{2}

A_{2}→ b A_{2}| λ - B
S → S

_{1}| S_{2}

S_{1}→ a S_{1}| aA_{1}

S_{2}→ aaS_{2}| A_{2}

A_{1}→ b A_{1}| λ

A_{2}→ b A_{2}| λ - C
S → S

_{1}| S_{2}

S_{1}→ aaa S_{1}| aA_{1}

S_{2}→ aaS_{2}| A_{2}

A_{1}→ b A_{1}| λ

A_{2}→ b A_{2}| λ - D
S → S

_{1}| S_{2}

S_{1}→ aa S_{1}| A_{1}

S_{2}→ aaS_{2}| aA_{2}

A_{1}→ bb A_{1}| λ

A_{2}→ bb A_{2}| b

- Option : D
- Explanation :

Given, L = L = {a^{n}b^{m}| 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;

S_{1}→ aa S_{1}| A_{1}

A_{1}→ bb A_{1}| λ

For n and m odd, grammar is:

S_{2}→ aaS_{2}| aA_{2}

A_{2}→ bbA_{2}| b

Now, combine both; then resultant grammar is:

S → S_{1}| S_{2}

S_{1}→ aa S_{1}| A_{1}

S_{2}→ aaS_{2}| aA_{2}

A_{1}→ bb A_{1}| λ

A_{2}→ bb A_{2}| b

You must be logged in to post a comment.

You must be logged in to post a comment.

- Option : D
- Explanation :
- (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. So, option (D) is correct.

You must be logged in to post a comment.

You must be logged in to post a comment.

- Option : A
- 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.

You must be logged in to post a comment.

You must be logged in to post a comment.

You must be logged in to post a comment.