GATE CS 2024 (Forenoon) — Question 39

Compiler DesignIntermediate Code Generation & Local Code OptimizationMCQ2 marks · −2/3 if wrongMedium

Consider the following pseudo-code. \( L1: \quad t1 = -1 \) \( L2: \quad t2 = 0 \) \( L3: \quad t3 = 0 \) \( L4: \quad t4 = 4 * t3 \) \( L5: \quad t5 = 4 * t2 \) \( L6: \quad t6 = t5 * M \) \( L7: \quad t7 = t4 + t6 \) \( L8: \quad t8 = a[t7] \) \( L9: \quad \text{if } t8 <= \max \text{ goto } L11 \) \( L10: \quad t1 = t8 \) \( L11: \quad t3 = t3 + 1 \) \( L12: \quad \text{if } t3 < M \text{ goto } L4 \) \( L13: \quad t2 = t2 + 1 \) \( L14: \quad \text{if } t2 < N \text{ goto } L3 \) \( L15: \quad \max = t1 \) Which one of the following options CORRECTLY specifies the number of basic blocks and the number of instructions in the largest basic block, respectively?
  1. A
    6 and 6
  2. B
    6 and 7
  3. C
    7 and 7
  4. D
    7 and 6
Practise the full 2024-FN paper
Challenge a friend: WhatsApp Telegram
Recommended book · affiliate linkCompilers: Principles, Techniques & ToolsThe "Dragon Book" for parsing, syntax-directed translation and code generation.
Practise more on Intermediate Code Generation & Local Code OptimizationTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group