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

GATE 2017-2018 :: GATE CSE

  1. A shared variable x, initialized to zero, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x from memory, increments by one, stores it to memory, and then terminates. Each of the processes Y and Z reads x from memory, decrements by two, stores it to memory, and then terminates. Each process before reading x invokes the P operation (i.e., wait) on a counting semaphore S and invokes the V operation (i.e., signal) on the semaphore S after storing x to memory. Semaphore S is initialized to two. What is the maximum possible value of x after all processes complete execution?
  2. A.
    -2
    B.
    -1
    C.
    1
    D.
    2

  3. Consider the following relational schema. 
    Students(rollno: integer, sname: string) 
    Courses(courseno: integer, cname: string) 
    Registration(rollno: integer, courseno: integer, percent: real)
    Which of the following queries are equivalent to this query in English?
    "Find the distinct names of all students who score more than 90% in the course numbered 107
    (I) SELECT DISTINCT S.sname
    FROM Students as S, Registration as R
    WHERE R.rollno=S.rollno AND R.courseno=107 AND R.percent >90
    (II) Πsname = (σcourseno=107 ∧ percent>90 (Registration ⋈ Students))
    (III) {T|ƎSϵ Students, ƎRϵ Registration ( S.rollno=R.rollno ∧ R.courseno=107 ∧ R.percent>90 ∧T.sname=S.sname)}
    (IV) {(SN) | ƎSRƎRP ((SR, SN)ϵ Students ∧ SR, 107, RP > ϵ Registration ∧ RP>90)}
  4. A.
    I, II, III and IV
    B.
    I, II and III only
    C.
    I, II and IV only
    D.
    II, III and IV only

  5. Determine the maximum length of the cable (in km) for transmitting data at a rate of 500 Mbps in an Ethernet LAN with frames of size 10,000 bits. Assume the signal speed in the cable to be 2,00,000 km/s.
  6. A.
    1
    B.
    2
    C.
    2.5
    D.
    5

  7. In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total length is 400 and the fragment offset value is 300. The position of the datagram, the sequence numbers of the first and the last bytes of the payload, respectively are
  8. A.
    Last fragment, 2400 and 2789
    B.
    First fragment, 2400 and 2759
    C.
    Last fragment, 2400 and 2759
    D.
    Middle fragment, 300 and 689

  9. The following figure represents access graphs of two modules M1 and M2. The filled circles represent methods and the unfilled circles represent attributes. If method m is moved to module M2 keeping the attributes where they are, what can we say about the average cohesion and coupling between modules in the system of two modules?

  10. A.
    There is no change.
    B.
    Average cohesion goes up but coupling is reduced.
    C.
    Average cohesion goes down and coupling also reduces.
    D.
    Average cohesion and coupling increase.

  11. A certain computation generates two arrays a and b such that a[i]=f(i) for 0 ≤ i < n and b[i] = g (a[i] )for 0 ≤ i < n. Suppose this computation is decomposed into two concurrent processes X and Y such that X computes the array a and Y computes the array b. The processes employ two binary semaphores R and S, both initialized to zero. The array a is shared by the two processes. The structures of the processes are shown below.
         
    Which one of the following represents the CORRECT implementations of ExitX and EntryY?
  12. A.
    .

    B.
    .

    C.
    .

    D.
    .


  13. Consider the following two sets of LR(1) items of an LR(1) grammar.
    X → c.X, c/d     X → c.X, $
    X → .cX, c/d     X →.cX, $
    X → .d, c/d       X →.d, $
    Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE?
    1. Cannot be merged since look aheads are different.
    2. Can be merged but will result in S-R conflict.
    3. Can be merged but will result in R-R conflict.
    4. Cannot be merged since go to on c will lead to two different sets.
  14. A.
    1 only
    B.
    2 only
    C.
    1 and 4 only
    D.
    1, 2, 3 and 4

  15. Which of the following is/are undecidable?

    1. G is a CFG. Is L(G) = Φ?

    2. G is a CFG. Is L(G) = Σ*?

    3. M is a Turing machine. Is L(M) regular?

    4. A is a DFA and N is an NFA. Is L(A) = L(N)?

  16. A.
    3 only
    B.
    3 and 4 only
    C.
    1, 2 and 3 only
    D.
    2 and 3 only

  17. The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
  18. A.
    10, 20, 15, 23, 25, 35, 42, 39, 30
    B.
    15, 10, 25, 23, 20, 42, 35, 39, 30
    C.
    15, 20, 10, 23, 25, 42, 35, 39, 30
    D.
    15, 10, 23, 25, 20, 35, 42, 39, 30

  19. Consider the following operation along with Enqueue and Dequeue operations on queues, where k is a global parameter.

    MultiDequeue(Q){ 
             m = k 
             while (Q is not empty) and (m > 0) { 
                          Dequeue(Q) 
                          m = m “ 1
               }
     }

    What is the worst case time complexity of a sequence of n queue operations on an initially empty queue?
  20. A.
    Θ(n)
    B.
    Θ(n + k)
    C.
    Θ(nk)
    D.
    Θ(n2)