The GATE Grind

GATE 2007 CS – Question 71

Computer Organization and Architecture · Instruction Set and Addressing Modes · 2 marks · Multiple choice

R1, R2, R3 are general-purpose registers. Program below is loaded at memory1000; instruction word counts shown. M[3000]=10, R3=2000; each M[2000] through M[2010] initially100. All numbers decimal.

       MOV R1,(3000) ; R1←M[3000]       ;2 words
LOOP:  MOV R2,(R3)   ; R2←M[R3]         ;1 word
       ADD R2,R1    ; R2←R1+R2         ;1 word
       MOV (R3),R2  ; M[R3]←R2         ;1 word
       INC R3       ; R3←R3+1          ;1 word
       DEC R1       ; R1←R1−1          ;1 word
       BNZ LOOP     ; branch ifnotzero ;2 words
       HALT         ; stop             ;1 word

Assume word-addressable memory. How many memory references access data during complete execution?

  1. 10
  2. 11
  3. 20
  4. 21

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (D) 21

Explanation

We are sorry we couldn't write detailed soluition for this, we are working on it!, please consider asking your own AI, its just 2-3 clicks with very minimum effort

More Instruction Set and Addressing Modes questions

All Instruction Set and Addressing Modes questions →