Multiple choice

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

InstructionR OperationR Instruction size (no. of words)R
MOV R1, (3000)R R1 _ m[3000]R 2R
LOOP: MOV R2, (R3)R R2 _ M[R3]R 1R
ADD R2, R1R R2 _ R1 + R2R 1R
MOV (R3), R2R M[R3] _ R2R 1R
INC R3R R3 _ R3 + 1R 1R
DEC R1R R1 _ R1 - 1R 1R
BNZ LOOPR Branch on not zeroR 2R
HALTR StopR 1R

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:

  1. 10

  2. 11

  3. 20

  4. 21

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation