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

2007

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

image.png

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 byte addressable and the word size is 32 bits. If an interrupt occurs during the execution of the instruction “INC R3”, what return address will be pushed on to the stack?

  1. A.

    1005

  2. B.

    1020

  3. C.

    1024

  4. D.

    1040

Attempted by 124 students.

Show answer & explanation

Correct answer: C

If memory is byte addressable so for each instruction it requires 1 word that is equal to 4 bytes which require 4 addresses

Instruction

Word

location

MOV R1,3000

2

1000-1007

MOV R2,R1

1

1008-1011

ADD R2,R1

1

1012-1015

MOV(R3),R2

1

1016-1019

INC R3

1

1020-1023

DEC R1

1

1024-1027

Interrupt occur during execution of instruction INC R3. So CPU will complete the execution of this instruction and push the next address 1024 in the stack. So after interrupt service program can be resumed for next instruction.

So (C) is correct option.

Explore the full course: Gate Guidance By Sanchit Sir