Skip to content
GATEiit

GATE CSE 2024 Session 2 Q43: Missing triples for x[i] = (p + r) * −s[i] + u/w

Question

Consider the following expression: x[i]=(p+r)∗−s[i]+u/wx[i] = (p + r) * -s[i] + u/w. The following sequence shows the list of triples representing the given expression, with entries missing for triples (1), (3), and (6).

(0)+pprr
(1)
(2)uminus(1)
(3)
(4)/uuww
(5)+(3)(4)
(6)
(7)=(6)(5)

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

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: A (official GATE 2024 final answer key)

Concept used: Triples for array access: =[] reads an indexed element, []= forms the indexed target of an assignment.

First step: Triple (1) must read s[i]s[i] before it is negated, and (3) multiplies (p+r)(p + r) by the negated value.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2024 Session 2 CS question paper and final answer key, organised by IISc Bangalore. Question paper · Answer key