PREVIOUS YEAR SOLVED PAPERS - GATE 2019

46. Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let X1, X2, X3, X4, X5 and X6 be the placeholders for the non-terminals D, T, L or L1 in the following table:

 Productions rule Semantic action
 D   TL X1 .type =  X2 .type
 T   int T.type = int
 T    float T.type = float
 L   L1 , id X3 .type = X4  .type add Type(id.entry, X5 .type)
 L   id addType(id.entry, X6 .type)

Which one of the following are the appropriate choices for 𝑋1, 𝑋2, 𝑋3 and 𝑋4?

  • Option : A
  • Explanation :
    SDT for inserting type information in the symbol table
    D → TL {L.idtype = T.stype}
    T → int {T.stype = int}
    T → float {T.stype = float}
    L → L1, id {L1.itype = L.itype}
    addtype(id.entry, L.itype)
    L → id addtype(id.entry, L.itype)
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 *


47. There are n unsorted arrays: A1, A2, ….,An. Assume that n is odd. Each of A1, A2, …., An contains n distinct elements. There are no common elements between any two arrays. The worst-case time complexity of computing the median of the medians of A1, A2, ….,An is ________ .

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 *


48. Let G be any connected, weighted, undirected graph.
I. G has a unique minimum spanning tree, if no two edges of G have the same weight.
II. G has a unique minimum spanning tree, if, for every cut of G, there is a unique minimum-weight edge crossing the cut.
Which of the above two statements is/are TRUE?

  • Option : C
  • Explanation : If no two edges of G have same weight surely G will have unique spanning tree is true.
    So I is true
    Also if, for every cut of G, there is a unique minimum weight edge crossing the cut then G will have unique spanning tree is also true. So II is true
    [Note: The converse of II is not true, but that is not relevant to this question]
    So both I and II are true.
    Option (C) 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 *


49. Consider the following snapshot of a system running n concurrent processes. Process i is holding Xi instances of a resource R, 1 ≤ i ≤ n. Assume that all instances of R arecurrently in use. Further, for all i, process i can place a request for at most Yi additional instances of R while holding the Xt instances it already has. Of the n processes, there are exactly two processes p and q such that Yp = Yq = 0.
Which one of the following conditions guarantees that no other process apart from p and q can complete execution?

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 *


50. Consider the following statements:
I. The smallest element in a max-heap is always at a leaf node
II. The second largest element in a max-heap is always a child of the root node
III. A max-heap can be constructed from a binary search tree in Θ(𝑛) time
IV. A binary search tree can be constructed from a max-heap in Θ(𝑛) time
Which of the above statements are TRUE?

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 2019