Consider the following program segment. Here R1, R2 and R3 are the general…
2007
Consider the following program segment. Here R1, R2 and R3 are the general purpose registers.

Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal. Assume that the memory is word addressable. The number of memory references for accessing the data in executing the program completely is:
Answer: D. 21 — Answer: 21 Explanation: Initial instruction MOV R1,(3000): this performs one data read from memory location 3000. After this, R1 = 10, so the loop executes 10…
- A.
10
- B.
11
- C.
20
- D.
21
Attempted by 41 students.
Show answer & explanation
Correct answer: D
Answer: 21
Explanation:
Initial instruction MOV R1,(3000): this performs one data read from memory location 3000.
After this, R1 = 10, so the loop executes 10 times.
Each loop iteration performs:
One data read: MOV R2,(R3) reads M[R3].
One data write: MOV (R3),R2 writes to M[R3].
Compute total data memory references:
Initial read: 1
Loop reads and writes: 10 iterations × 2 accesses per iteration = 20
Total = 1 + 20 = 21