Question
Consider the following expression: . The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6).
| Triple | Op | Arg 1 | Arg 2 |
|---|---|---|---|
| (0) | + | ||
| (1) | |||
| (2) | uminus | (1) | |
| (3) | |||
| (4) | / | ||
| (5) | + | (3) | (4) |
| (6) | |||
| (7) | = | (6) | (5) |
Which one of the following options fills in the missing entries CORRECTLY?
Official answer and solution
- Official answer
- A
- From
- Official GATE 2024 answer key
Solution
Trace the subexpressions of and distinguish r-value array read (=[] s i) from l-value indexed target ([]= x i).
- Triple (1): Triple (2) applies unary minus (
uminus) to(1), so(1)must fetch the r-value of , represented as=[] s i. - Triple (3): Multiplies
(0)() and(2)(), represented as* (0) (2). - Triple (6): Triple (7) assigns
(5)(the entire RHS value) to the target(6), so(6)represents the l-value array reference , written as[]= x i.
Hence (A) is the correct combination.
Final answer
Option (A)
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2024 Computer Science and Information Technology - Set 2 (CS2)
- Question
- 43 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.