GATE CS 2024 Set 1 | Question 39
Compiler Design › Intermediate Code & Code Optimization · MCQ · 2 marks · Answer: D
- Question 39Compiler Designmcq2 marksFor the given 15-line three-address pseudo-code (with gotos to L4, L3, L11), the number of basic blocks and the number of instructions in the largest basic block, respectively, are
- A.6 and 6
- B.6 and 7
- C.7 and 7
- D.7 and 6✓
Answer: D
Solution
Answer: (D) 7 and 6 Leaders: L1 (first); jump targets L3, L4, L11; and lines right after a jump: L10 (after L9), L13 (after L12), L15 (after L14). Leaders -> 7 basic blocks:
Largest block is B3 = L4..L9 = 6 instructions. So 7 blocks, largest 6.B1: L1-L2 B2: L3 B3: L4-L9 B4: L10 B5: L11-L12 B6: L13-L14 B7: L15 - A.
More GATE PYQ on Intermediate Code & Code Optimization
All GATE CS Compiler Design PYQ →Attempt GATE CS 2024 Set 1 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →