GATE Solved Paper 2017-19 - 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
Cancel reply

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