Computer Science EngineeringVery hard
For void f(int x, int y){ x = x + 1; y = y + x; } with int a = 1, b = 2; calling f(a, b) by reference, what are the values of a and b afterwards?
- A. a=1, b=2
- B. a=2, b=3
- C. a=2, b=4
- D. a=3, b=4
Correct answer: C. a=2, b=4
x aliases a so a becomes 2, and y aliases b so b becomes 2 + 2 = 4.
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
- Peephole optimization operates on
- In graph-colouring register allocation, the nodes of the interference graph represent
- S-attributed grammars use only which kind of attributes?
- In the dangling-else problem, the usual resolution is to associate an else with
- A shift-reduce conflict in an LR parser means that in some state the parser
- For a fixed grammar in Chomsky normal form, the CYK algorithm decides membership of a string of length n in time