Which of the following sequences of three-address instructions can be used to…

2018

Which of the following sequences of three-address instructions can be used to evaluate Y = (A-B)/(C+D*E)?

  1. A.

    SUB Y, A, B
    MPY T, D, E
    ADD T, T, C
    DIV T, Y, T

  2. B.

    SUB Y, A, B
    MPY T, D, E
    ADD T, T, C
    DIV Y, T, T

  3. C.

    SUB Y, A, B
    ADD T, T, C
    MPY T, D, E
    DIV Y, Y, T

  4. D.

    SUB Y, A, B
    MPY T, D, E
    ADD T, T, C
    DIV Y, Y, T

Attempted by 78 students.

Show answer & explanation

Correct answer: D

First, compute the numerator A minus B and store it in a temporary variable. Next, calculate D multiplied by E, then add C to that result for the denominator. Finally, divide the numerator value by the denominator value and assign it to Y.

Explore the full course: Uppsc Polytechnic Lecturer 2025 Cs