Which sequence of one-address, accumulator-based instructions can be used to…

2018

Which sequence of one-address, accumulator-based instructions can be used to evaluate Y = (A - B) / (C + D * E)?

  1. A.

    LOAD D
    MPY E
    ADD C
    STORE Y
    LOAD A
    SUB B
    DIV Y
    STORE Y

  2. B.

    LOAD D
    MPY E
    ADD C
    LOAD A
    STORE Y
    SUB B
    DIV Y
    STORE Y

  3. C.

    LOAD D
    ADD C
    MPY E
    STORE Y
    LOAD A
    SUB B
    DIV Y
    STORE Y

  4. D.

    LOAD D
    MPY E
    ADD C
    STORE Y
    LOAD A
    DIV Y
    SUB B
    STORE Y

Attempted by 145 students.

Show answer & explanation

Correct answer: A

Instruction logic:

  • Denominator: First compute D * E, then add C to get C + D * E. Store this intermediate value.

  • Numerator: Then compute A - B.

  • Final division: Divide the numerator by the stored denominator and store the result in Y.

Correct sequence:

LOAD D
MPY E
ADD C
STORE Y
LOAD A
SUB B
DIV Y
STORE Y

Final answer: Option A

Explore the full course: Up Lt Grade Assistant Teacher 2025