PREVIOUS YEAR SOLVED PAPERS - GATE 2020

31. Consider the productions A → PQ and A → XY. Each of the five non-terminals A,P,Q,X, and Y has two attributes: s is a synthesized attribute, and i is an inherited attribute. Consider the following rules.
Rule 1: P.i=A.i+2, Q.i=P.i+A.i, and A.s=P.s+Q.s
Rule 2: X.i=A.i+Y.s and Y.i=X.s+A.i
Which one of the following is TRUE?

  • Option : C
  • Explanation :
    Rule 1: Rule 1: It is Rule 1: L-attributed by definition.
    Rule 2: Rule 2: It is not L-attributed because this expression (X. Rule 2: i = A.i + Y.s) fails to satisfy the definition of L-attributed.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


32. Each of a set of Q.28 n processes executes the following code using two semaphores a and b initialized to 1 and 0, respectively. Assume that count is a shared variable initialized to 0 and not used in CODE SECTION P.

   CODE SECTION P
wait(a); count=count+1;
if (count==n) signal(b);
signal(a); wait(b); signal(b);
   CODE SECTION Q

What does the code achieve?

  • Option : C
  • Explanation :
    Subject Operating Systems
    a = 1 b = 0 count = 0
    Code section P: For process 1
    Wait (a) ⇒ a = 0
    Count ++ ⇒ count = 1
    If (count = = n) ⇒ false
    signal (a) ⇒ a = 0
    wait (b) process blocked
    As shown above, all processes execute wait (b) before, signal (b) in if condition.
    Because, ‘if’ condition becomes True only for process Pn(nth process) [∵ if (count = = n)]
    So, before Pn process finishes the code section, P, no other process executes code section Q.
    Hence, no process executes code section Q before every process has finished code section P.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


33. Let G = (V, E) be a weighted undirected graph and let T be a Minimum Spanning Tree (MST) of G maintained using adjacency lists. Suppose a new weighted edge (u,v) V × V is added to G. The worst case time complexity determining if T is still an MST of the resultant graph is

  • Option : D
  • Explanation :
    G = (V, E) T = MST
    Weighted edge ( μ, v) is added to T.
    To verify it is still a MST or not, we need to compare with all the vertices. So, it would be O(V).
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


34. Consider the following languages.
L1 = {wxyx | w,x,y(0+1)+}
L2 = {xy | x,y(a + b)*,|x| = |y|, x y}
Which one of the following is TRUE?

  • Option : A
  • Explanation :
    L1 is regular and L2 is CFL.
    L1: {ω xyx| ω, x, y ϵ (0 + 1)*}
    We can write the regular expression for this,
    Let, x = 0
    L11 = ω 0 Y 0 ⇒ ( 0 + 1)+ 0(0 + 1)+0
    x = 1
    L12 = ω 1 Y 1 ⇒ we can generate all the strings and since a regular expression can be written for 4, we can say 4 is regular.
    L2 is CFL:
    L2 = {xy| x,y ϵ (a + b)*, |x| = |y|, x ≠ y}
    L2 generates strings of even length, which can be done by PDA, therefore L2 is CFL.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


35. Consider the following five disk access requests of the form (request id, cylinder number) that are present in the disk scheduler queue at a given time.
(P, 155), (Q, 85), (R, 110), (S, 30), (T, 115)
Assume the head is positioned at cylinder 100. The scheduler follows Shortest Seek Time First scheduling to service the requests.
Which one of the following statements is FALSE?

  • Option : D
  • Explanation : Given P : 155
    Q : 85
    R : 110
    S : 30
    T : 115
    Current head position = 100
    SSTF = algorithm

    From the above sequence, we can say that option D is correct.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


Related Quiz.
GATE 2020