ISRO Scientist/Engineer CSE 2018Compiler Design › Code Optimization and Runtime Environment
ISRO Scientist/Engineer CSE 2018 PYQ: Which of the following comment about peep-hole optimization is true?
Which of the following comment about peep-hole optimization is true?
- AIt is applied to small part of the code and applied repeatedlyCorrect answer
- BIt can be used to optimize intermediate code
- CIt can be applied to a portion of the code that is not contiguous
- DIt is applied in symbol table to optimize the memory requirements.
Answer
(A) It is applied to small part of the code and applied repeatedly
Approach
The question uses singular phrasing ('which... comment... is true'), signalling exactly one correct option. The textbook definition of peephole optimization (Aho et al.) is a local code-improvement pass that examines a short, contiguous 'peephole' of instructions and is applied repeatedly across the program — precisely option A. Option C is false because a peephole is by definition a contiguous sliding window, not a non-contiguous set of instructions. Option D is false: symbol-table memory optimisation is unrelated to peephole optimization. Option B is the only distractor with any surface plausibility, but peephole optimization is standardly defined as a target-code (or single-representation local) transformation, and in a single-answer framing it is not the statement being tested; B is included only as a near-miss. Therefore the one true statement about peephole optimization is A.
Reviewed by ISRO IQ Editorial Team.