UGC NET COMPUTER SCIENCE SOLVED PAPERS 2014-16 - UGC NET Computer Science Paper 3 August 2016

21. Assume that the program ‘P’ is implementing parameter passing with ‘call by reference’. What will be printed by following print statements in P?
Program P()
{
x = 10;
y = 3;
funb (y, x, x)
print x;
print y;
}f
unb (x, y, z)
{
y = y + 4;
z = x + y + z;

  • 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.
Cancel reply
Cancel reply

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

  • Option : D
  • 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
Cancel reply
Cancel reply

23. Let Σ = {a, b} and language L = {aa, bb}. Then, the complement of L is

  • Option : D
  • 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.
Cancel reply
Cancel reply

24. Consider the following identities for regular expressions:
(a) (r + s)* = (s + r)*
(b) (r*)* = r*
(c) (r* s*)* = (r + s)*
Which of the above identities are true?

  • 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.
Cancel reply
Cancel reply

25. Suppose transmission rate of a channel is 32 kbps. If there are ‘8’ routes from source to destination and each packet p contains 8000 bits. Total end to end delay in sending packet P is _____.

  • 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.
Cancel reply
Cancel reply