Compiler Design GATE CS and IT previous year questions with answer
Ques 1 Gate 2022
Which one of the following statements is TRUE?
Ques 2 GATE 2021 SET-2
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?
Ques 3 Gate 2020
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 2: X.i=A.i+Y.s and Y.i=X.s+A.i
Ques 4 Gate 2020
Consider the following statements.
I. Symbol table is accessed only during lexical analysis and syntax analysis.
II. Compilers for programming languages that support recursion necessarily need heap storage for memory allocation in the run-time environment.
III. Errors violating the condition ‘any variable must be declared before its use’ are detected during syntax analysis.
Which of the above statements is/are TRUE ?
Ques 5 Gate 2020
Consider the following grammar.
B → b
The number of reduction steps taken by a bottom-up parser while accepting the string aaadbbb is ________ .
7 is the correct answer.
Ques 6 Gate 2019
Which one of the following kinds of derivation is used by LR parsers?
Ques 7 Gate 2019
Consider the augmented grammar given below:
S → ⏐id
L → L, S⏐S
Let I0= CLOSURE ({[S′ → S]}).
The number of items in the set GOTO (I0, <) is __________.
5 is the correct answer.
Ques 8 Gate 2017 Set-2
Which of the following statements about the parser is/are correct?
I. Canonical LR is more powerful than SLR.
II. SLR is more powerful than LALR.
III. SLR is more powerful than canonical LR.
Ques 9 Gate 2017 Set-2
Match the following according to input(from the left column) to the compiler phase(in the right column) that process it:
(P)Syntax Tree | (i)Code generator |
(Q)Character Stream | (ii)Syntax analyser |
(R)Intermediate representation | (iii)Semantic analyser |
(S)Token stream | (iv)Lexical analyser |
Ques 10 Gate 2016 Set-2
Match the following
(P) Lexical analysis | (i)Leftmost derivation |
(Q) Top down parsing | (ii) Type checking |
(R) Semantic analysis | (iii) Regular expressions |
(S) Runtime environments | (iv) Activation records |