Home / GATE 2017-2018 / GATE CSE :: Practice Test Paper 1

GATE 2017-2018 :: GATE CSE

  1. The height of a tree is defined as the number of edges on the longest path in the tree. The function shown in the pseudo code below is invoked as height(root) to compute the height of a binary tree rooted at the tree pointer root.

    The appropriate expressions for the two boxes B1 and B2 are
  2. A.
    B1: (1+height(n →
    B.
    B1: (height(n →
    C.
    B1: height(n →
    D.
    B1: (1+ height(n →

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Consider the following C code segment.

    What output will be generated by the given code segment?
  4. A.
    3 1 
    4 1 
    4 2
    B.
    4 2 
    6 1 
    6 1
    C.
    4 2 
    6 2 
    2 0
    D.
    3 1 
    5 2 
    5 2

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Consider the following C code segment.

    What output will be generated by the given code segment if: 
    Line 1 is replaced by    auto int a = 1; 
    Line 2 is replaced by    register int a = 2;
  6. A.
    3 1 
    4 1 
    4 2
    B.
    4 2 
    6 1 
    6 1
    C.
    4 2 
    6 2 
    2 0
    D.
    4 2 
    4 2 
    2 0

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Consider the following relations A, B and C:
       

    How many tuples does the result of the following relational algebra expression contain? Assume that the schema of A∪B is the same as that of A.
    (A∪B) ⋈A.Id > 40 ᴠ C.Id < 15 C
  8. A.
    7
    B.
    4
    C.
    5
    D.
    9

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. ε is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.
    S → a A b B | b A a B | ε
    A → S
    B → S

    The FIRST and FOLLOW sets for the non-terminals A and B are
  10. A.
    FIRST(A) = {a, b, ε} = FIRST(B) 
    FOLLOW(A) = {a, b} 
    FOLLOW(B) = {a, b, $}
    B.
    FIRST(A) = {a, b, $} 
    FIRST(B) = {a, b, ε} 
    FOLLOW(A) = {a, b} 
    FOLLOW(B) = {$}
    C.
    FIRST(A) = {a, b, ε} = FIRST(B) 
    FOLLOW(A) = {a, b} 
    FOLLOW(B) = Ø
    D.
    FIRST(A) = {a, b} = FIRST(B) 
    FOLLOW(A) = {a, b} 
    FOLLOW(B) = {a, b}

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. ε is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.
    S → a A b B | b A a B | ε
    A → S
    B → S

    The appropriate entries for E1, E2, and E3 are
  12. A.
    E1: S →
    B.
    E1: S →
    C.
    E1: S →
    D.
    E1: A →

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. A computer has a 256 KByte, 4-way set associative, write back data cache with block size of 32 Bytes. The processor sends 32 bit addresses to the cache controller. Each cache tag directory entry contains, in addition to address tag, 2 valid bits, 1 modified bit and 1 replacement bit.
    The number of bits in the tag field of an address is
  14. A.
    11
    B.
    14
    C.
    16
    D.
    27

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. A computer has a 256 KByte, 4-way set associative, write back data cache with block size of 32 Bytes. The processor sends 32 bit addresses to the cache controller. Each cache tag directory entry contains, in addition to address tag, 2 valid bits, 1 modified bit and 1 replacement bit.
    The size of the cache tag directory is
  16. A.
    160 Kbits
    B.
    136 Kbits
    C.
    40 Kbits
    D.
    32 Kbits

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. The cost function for a product in a firm is given by 5q2, where q is the amount of production. The firm can sell the product at a market price of Rs. 50 per unit. The number of units to be produced by the firm such that the profit is maximized is
  18. A.
    5
    B.
    10
    C.
    15
    D.
    25

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. Choose the most appropriate alternative from the options given below to complete the following sentence: 
    Despite several “““““““““ the mission succeeded in its attempt to resolve the conflict.
  20. A.
    attempts
    B.
    setbacks
    C.
    meetings
    D.
    delegations

    View Answer

    Workspace

    Discuss Discuss in Forum