Computer Science EngineeringHardISRO SC
A flow graph has blocks B1: use{a,d} def{b}; B2: use{a} def{b,d}; B3: use{d} def{a,b,c}; B4: use{a} def{}. Edges: B1->B2, B2->B3, B2->B4, B3->B2. Variables are live at exit only if a later use exists; B4 is the exit. How many variables are live at the entry (IN) of B1? (use = read before any write in the block)
- A. 3
- B. 1
- C. 4
- D. 2
Correct answer: D. 2
Solve IN[B]=use[B] union (OUT[B]-def[B]) and OUT[B]=union of IN[succ] backward to a fixed point; IN[B1] = {a,d}.
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
- Build the DAG for ((((c + a) + (b - a)) ((a b) + (b + a))) + (((a b) + (b + a)) + ((a b) + (b + a)))) using value numbering, treating +…
- 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…