Compiler Design questions

Q17

GATE CS 2014 CS-2ParsingMCQ1 mark−1/3 if wrong
Consider the grammar defined by the following production rules, with two operators ∗* and ++

S→T∗PS \rightarrow T * P
T→U∣T∗UT \rightarrow U \mid T * U
P→Q+P∣QP \rightarrow Q + P \mid Q
Q→IdQ \rightarrow Id
U→IdU \rightarrow Id

Which one of the following is TRUE?
Show answer without attempting

Answer: B

Q18

GATE CS 2014 CS-2Runtime EnvironmentsMCQ1 mark−1/3 if wrong
Which one of the following is NOT performed during compilation?
Show answer without attempting

Answer: A

Q34

GATE CS 2014 CS-2Intermediate CodeMCQ2 marks−2/3 if wrong
For a C program accessing X[i][j][k], the following intermediate code is generated by a compiler. Assume that the size of an integer is 32 bits and the size of a character is 8 bits.
t0 = i * 1024
t1 = j * 32
t2 = k * 4
t3 = t1 + t0
t4 = t3 + t2
t5 = X[t4]
Which one of the following statements about the source code for the C program is CORRECT?
Show answer without attempting

Answer: A

Q17

GATE CS 2014 CS-3Intermediate CodeMCQ1 mark−1/3 if wrong
One of the purposes of using intermediate code in compilers is to
Show answer without attempting

Answer: C

Q18

GATE CS 2014 CS-3Runtime EnvironmentsMCQ1 mark−1/3 if wrong
Which of the following statements are CORRECT?

1) Static allocation of all data areas by a compiler makes it impossible to implement recursion.
2) Automatic garbage collection is essential to implement recursion.
3) Dynamic allocation of activation records is essential to implement recursion.
4) Both heap and stack are essential to implement recursion.
Show answer without attempting

Answer: D

Q34

GATE CS 2014 CS-3Optimization and Data FlowMCQ2 marks−2/3 if wrong
Consider the basic block given below.

a = b + c
c = a + d
d = b + c
e = d - b
a = e + b

The minimum number of nodes and edges present in the DAG representation of the above basic block respectively are
Show answer without attempting

Answer: A

Q17

GATE CS 2014 CS-1Optimization and Data FlowMCQ1 mark−1/3 if wrong
Which one of the following is FALSE?
Show answer without attempting

Answer: D

Q34

GATE CS 2014 CS-1ParsingMCQ2 marks−2/3 if wrong
A canonical set of items is given below

S→L⋅>RS \to L \cdot > R
Q→R⋅Q \to R \cdot

On input symbol << the set has
Show answer without attempting

Answer: D

0/80 correct0 marks

Related topics in GATE CS