Consider the following expression: π‘₯[𝑖] = (𝑝 + π‘Ÿ) βˆ— βˆ’π‘ [𝑖] + 𝑒/𝑀. The…

2024

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).

(0)

Β  Β  Β  Β  Β  Β +

(1)

(2)

Β  Β  Β  Β uminus

Β  Β  Β  (1)

(3)

(4)

Β  Β  Β  Β  Β  Β /

Β  Β  Β  Β u

Β  Β  Β  w

(5)

Β  Β  Β  Β  Β  +

Β  Β  Β (3)

Β  Β  Β (4)

(6)

(7)

Β  Β  Β  Β  Β =

Β  Β  Β (6)

Β  Β  Β (5)

Which one of the following options fills in the missing entries CORRECTLY?

  1. A.

    (1) =[] 𝑠 𝑖 (3) * (0) (2) (6) []= π‘₯ 𝑖

  2. B.

    (1) []= 𝑠 𝑖 (3) – (0) (2) (6) =[] π‘₯ (5)

  3. C.

    (1) =[] 𝑠 𝑖 (3) * (0) (2) (6) []= π‘₯ (5)

  4. D.

    (1) []= 𝑠 𝑖 (3) – (0) (2) (6) =[] π‘₯ 𝑖

Attempted by 67 students.

Show answer & explanation

Correct answer: A

Key idea: build triples for array access, unary minus, binary operators, and the final store.

  • (0) + p r β€” computes p + r.

  • (1) =[] s i β€” loads s[i] (array access).

  • (2) uminus (1) β€” forms -s[i] using the result of (1).

  • (3) * (0) (2) β€” multiplies (p + r) from (0) with -s[i] from (2).

  • (4) / u w β€” computes u / w.

  • (5) + (3) (4) β€” adds the product (3) and the division (4).

  • (6) []= x i β€” builds the address for x[i] (left-hand side).

  • (7) = (6) (5) β€” stores the value from (5) into x[i] using the address (6).

This sequence matches the expression x[i] = (p + r) * -s[i] + u/w: the correct fills are (1) =[] s i, (3) * (0) (2), and (6) []= x i.

A video solution is available for this question β€” log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir