Intermediate Code Generation: GATE CS Previous Year Questions

Intermediate Code Generation · Compiler Design

32 questions · asked in 16 of 27 years (2000–2026)

MCQ 26 · MSQ 1 · NAT 51-mark 13 · 2-mark 19

2000Questions per year2026

Questions 6–10 of 32

Q6GATE 2024 (Session 1)2 marksMCQ−0.67 if wrong
Consider the following pseudo-code.
L1:t1=−1L2:t2=0L3:t3=0L4:t4=4∗t3L5:t5=4∗t2L6:t6=t5∗ML7:t7=t4+t6L8:t8=a[t7]L9:if  t8<=max  goto  L11L10:t1=t8L11:t3=t3+1L12:if  t3<M  gotoL4L13:t2=t2+1L14:if  t2<N  goto  L3L15:max=t1\begin{array}{ll} L 1: & t 1=-1 \\ L 2: & t 2=0 \\ L 3: & t 3=0 \\ L 4: & t 4=4 * t 3 \\ L 5: & t 5=4 * t 2 \\ L 6: & t 6=t 5 * M \\ L 7: & t 7=t 4+t 6 \\ L 8: & t 8=a[t 7] \\ L 9: & if \; t 8 \lt = max \; goto \; L 11 \\ L 10: & t 1=t 8 \\ L 11: & t 3=t 3+1 \\ L 12: & if \; t 3 \lt M \; goto L 4 \\ L 13: & t 2=t 2+1 \\ L 14: & if \; t 2 \lt N \; goto \; L 3 \\ L 15: & max =t 1 \end{array}
Which of of the following options CORRECTLY specifies the number of basic blocks and the number of instructions in the largest basic block, respectively?

Q7GATE 2024 (Session 2)2 marksMCQ−0.67 if wrong
Consider the following expression: x[i]=(p+r)∗−s[i]+u/wx[i]=(p+r) *-s[i]+u / w. The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6).
(0)+pr(1)(2)uminus(1)(3)(4)/uw(5)+(3)(4)(6)(7)=(6)(5)\begin{array}{|c|c|c|c|} \hline (0) & + & p & r \\ \hline (1) & & & \\ \hline (2) & uminus & (1) & \\ \hline (3) & & & \\ \hline (4) & / & u & w \\ \hline (5) & + & (3) & (4) \\ \hline (6) & & & \\ \hline (7) & = & (6) & (5) \\ \hline \end{array}
Which one of the following options fills in the missing entries CORRECTLY?

Q8GATE 20231 markMCQ−0.33 if wrong
Consider the following statements regarding the front-end and back-end of a compiler.

S1: The front-end includes phases that are independent of the target hardware.
S2: The back-end includes phases that are specific to the target hardware.
S3: The back-end includes phases that are specific to the programming language used in the source code.

Identify the CORRECT option.

Q9GATE 20232 marksMCQ−0.67 if wrong
Consider the control flow graph shown.
ENTRYEXIT B1B2B3B4 i = m - 1j = na = 10i = i + 1j = j - 1a = 20i = a + 1
Which one of the following choices correctly lists the set of live variables at the exit point of each basic block?

Q10GATE 2021 (Session 2)1 markMSQ
In the context of compilers, which of the following is/are NOT an intermediate representation of the source program?

One or more options are correct.

Keep practising

Topics in Compiler Design

All CS topics ›