GATE Computer ScienceModerateGATE CS (PYQ pattern)
Which of the following about intermediate representations is/are true? I. In triples, an operand that is a result of another statement is referred to by that statement's position, so moving a statement needs renumbering. II. Indirect triples allow an optimiser to reorder statements by changing only the list of pointers. III. Quadruples name every result explicitly, so statements can be moved without changing the others. IV. A DAG of a basic block cannot show common sub-expressions.
- A. I, II and III only
- B. I and II only
- C. II, III and IV only
- D. I, III and IV only
Correct answer: A. I, II and III only
I-III are the standard properties; IV is false, since detecting common sub-expressions is the main use of the DAG.
More Compiler Design questions
- Backpatching with no fall-through optimisation, numbering from 100, for: if (!(p < q)) x = 1; while (i < n) { if (a < b || c < d) k = k +…
- An LR parser for E → id | E [ E ] | ( E ) parses "( id ) [ id ]". Each shift and each reduce is one move (the final accept is not a move)…
- SDD: S → ( S S ) | a. Inherited attribute S.d: the root has S.d = 0 and each child of a node gets parent.d + 1. Synthesised S.v: for a →…
- A Pascal-like scanner uses longest match (ties to the earlier rule) with rules: FLOAT = [0-9]+.[0-9]; INT = [0-9]+; RANGE = ..; DOT =…
- SDD: S → ( S S ) | a. S.d is inherited: root d = 0, children get parent.d + 1. For a → a: S.v = S.d if S.d is even, otherwise −S.d. For S…
- int i = 1; int A[1..4] = {4, 7, 2, 9}; void swap(x, y) { int t = x; x = y; y = t; } The call swap(i, A[i]) is made. The parameters are…