The memory locations 1000, 1001 and 1020 have data values 18, 1 and 16…

2006

The memory locations 1000, 1001 and 1020 have data values 18, 1 and 16 respectively before the following program is executed.

MOVI         Rs, 1                     ; Move immediate

LOAD        Rd, 1000(Rs)     ; Load from memory

ADDI         Rd, 1000             ; Add immediate

STOREI    0(Rd), 20             ; Store immediate

Which of the statements below is TRUE after the program is executed ?

  1. A.

    Memory location 1000 has value 20

  2. B.

    Memory location 1020 has value 20

  3. C.

    Memory location 1021 has value 20

  4. D.

    Memory location 1001 has value 20

Attempted by 250 students.

Show answer & explanation

Correct answer: D

Final result: memory location 1001 contains 20; other listed locations remain unchanged.

  1. MOVI Rs, 1 sets Rs = 1.

  2. LOAD Rd, 1000(Rs) reads from address 1000 + Rs = 1001. The value at memory[1001] is 1, so Rd = 1.

  3. ADDI Rd, 1000 adds 1000 to Rd, so Rd = 1 + 1000 = 1001.

  4. STOREI 0(Rd), 20 stores the immediate value 20 at address Rd + 0 = 1001, so memory[1001] becomes 20.

Therefore, memory location 1001 has value 20. Memory location 1000 remains 18 and memory location 1020 remains 16; memory location 1021 is not modified by this program.

Explore the full course: Gate Guidance By Sanchit Sir