Computer Science EngineeringVery hard
How many nodes does the DAG for the expression a + a*(b-c) + (b-c)*d contain (common subexpressions shared)?
- A. 8
- B. 9
- C. 10
- D. 11
Correct answer: B. 9
There are 4 leaves (a,b,c,d) and 5 operator nodes: b-c, a*(b-c), the first +, (b-c)*d and the final +.
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
- Type checking of expressions is performed during which phase of a compiler?
- A string of length 5 is derived in a grammar in Chomsky normal form. How many derivation steps are required?
- Deterministic context-free languages are closed under
- Rice's theorem states that every non-trivial property of which of the following, for a Turing machine, is undecidable?
- For the grammar S -> AB, A -> a | epsilon, B -> b, what is FIRST(S)?
- How many LR(0) items does the production A -> XYZ generate?