Computer Science EngineeringHardISRO SC
Build the DAG for ((((c + a) + (b - a)) * ((a * b) + (b + a))) + (((a * b) + (b + a)) + ((a * b) + (b + a)))) using value numbering, treating + and * as commutative (so a+b and b+a share a node) and - as non-commutative. The number of operator (interior) nodes in the DAG is
- A. 10
- B. 9
- C. 8
- D. 11
Correct answer: B. 9
Assign a value number to each (op, operand numbers) key; duplicates collapse. 9 distinct operator nodes (12 nodes in total with leaves).
Practise more Theory of Computation, Compilers & Digital Logic (ISRO CS) questionsTheory of Computation, Compilers & Digital Logic (ISRO CS): notes and key points
More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions
- A scanner uses maximal munch with identifiers [a-z][a-z0-9], decimals digits(.digits)?, and operators/punctuators including <<=, <<, <=…
- Nested procedures use static (access) links. A procedure at nesting depth 4 references a local variable declared in an enclosing procedure…
- Nested procedures use static (access) links. A procedure at nesting depth 3 references a local variable declared in an enclosing procedure…
- Global int g = 2; procedure P(a, b) { a = a + 5; b = b + a; print(a + b + g); } is called as P(g, g). The value printed under call by…
- How many of the following operations are guaranteed to produce a context-free language when applied to context-free languages L1, L2 and a…
- A shift/reduce conflict in a Yacc-style generator that is not resolved by precedence declarations is, by default, resolved by