UGC NET Paper 2 (Computer Science)Very hard
For the basic block t1 = a + b; t2 = t1 * c; t3 = a + b; t4 = t3 - t2, after building a DAG and eliminating common sub-expressions, the minimum number of three-address statements needed is:
- A. 3
- B. 4
- C. 2
- D. 5
Correct answer: A. 3
The DAG recognises that t3 recomputes the same value as t1, so t3's references are replaced by t1, leaving only t1 = a + b; t2 = t1 * c; t4 = t1 - t2.
Practise more UGC NET Computer Science and Applications questionsUGC NET Computer Science and Applications: notes and key points
More UGC NET Computer Science and Applications questions
- Solve the recurrence relation given by T(n) = 2T(n/2) + n log n, assuming n is a power of 2, for its asymptotic (Theta) bound.
- The recurrence T(n) = 2T(n/2) + n/log n has the solution:
- For T(n) = T(n/2) + T(n/4) + n, the asymptotic solution is:
- The number of structurally distinct binary trees with 5 nodes is:
- The information-theoretic lower bound on the number of comparisons needed to sort 5 distinct elements is:
- Consider. I. Kruskal's algorithm runs in O(E log E) with sorting. II. Prim's algorithm with a binary heap runs in O(E log V). III…