GATE 2019 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2019

65 questions

MCQ 41 · NAT 241-mark 30 · 2-mark 35

Questions 46–50 of 65

Q46Syntax-directed Translation2 marksMCQ−0.67 if wrong
Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let X1,X2,X3,X4,X5  and  X6X_1,X_2,X_3,X_4,X_5 \; and \; X_6 be the placeholders for the non-terminals D, T, L or L1L_1 in the following table:
Production ruleSemantic action
D → T LX1.type = X2.type
T → intT.type = int
T → floatT.type = float
L → L1 , idX3.type = X4.type
addType(id.entry, X5.type)
L → idaddType(id.entry, X6.type)

Which one of the following are the appropriate choices for X1,X2,X3  and  X4X_1,X_2,X_3 \; and \; X_4?

Q47Asymptotic Notation2 marksMCQ−0.67 if wrong
There are n unsorted arrays: A1,A2,...,AnA_1,A_2,...,A_n. Assume that n is odd. Each of A1,A2,...,AnA_1,A_2,...,A_n 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,...,AnA_1,A_2,...,A_n is ________ .

Q48Minimum Spanning Tree2 marksMCQ−0.67 if wrong
Let G be any connection, 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?

Q49Deadlock2 marksMCQ−0.67 if wrong
Consider the following snapshot of a system running n concurrent processes. Process ii is holding XiX_i instances of a resource R, 1≤i≤n1\leq i\leq n. Assume that all instances of R are currently in use. Further, for all ii, process ii can place a request for at most YiY_i additional instances of R while holding the XiX_i instances it already has. Of the n processes, there are exactly two processes p and q such that Yp=Yq=0Y_p=Y_q=0. Which one of the following conditions guarantees that no other process apart from p and q can complete execution?

Q50Heap Tree2 marksMCQ−0.67 if wrong
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 Θ(n)\Theta (n) time.
IV. A binary search tree can be constructed from a max-heap in Θ(n)\Theta (n) time.

Which of the above statements is/are TRUE?