Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
315 views
in Computer by (106k points)
closed by

Consider the following instruction sequence where register R1, R2 and R3 are general purpose and MEMORY[X] denotes the content at the memory location X.

Instruction

Semantics

Instruction Size (bytes)

MOV R1, (5000)

R1 ← MEMORY[5000]

4

MOV R2, (R3)

R2 ← MEMORY[R3]

4

ADD R2, R1

R2 ← R1 + R2

2

MOV (R3), R2

MEMORY[R3] ← R2

4

INC R3

R3 ← R3 + 1

2

DEC R1

R1 ← R1 – 1

2

BNZ 1004

Branch if not zero to the given absolute address

2

HALT

Stop

1

 

Assume that the content of the memory location 5000 is 10, and the content of the register R3 is 3000. The content of each of the memory locations from 3000 to 3010 is 50. The instruction sequence starts from the memory location 1000. All the numbers are in decimal format. Assume that the memory is byte addressable.

After the execution of the program, the content of memory location 3010 is ______

1 Answer

0 votes
by (103k points)
selected by
 
Best answer

Answer: 50 to 50 

Explanation

Consider following memory cells

Address

Value

5000

10

3000

50

3001

50

3002

50

3003

50

3004

50

3005

50

3006

50

3007

50

3008

50

3009

50

3010

50

After Executing till 3 instruction we have the following value in Registers

R1

R2

R3

10

50

3000

After 4th instruction, M[R3] ( M[3000]) will be updated as 50 + 10 = 60 

Address

Value

5000

10

3000

60

3001

50

3002

50

3003

50

3004

50

3005

50

3006

50

3007

50

3008

50

3009

50

3010

50

R3 => R3 +1 => 3001

R1 = 9 Hence it is Nonzero; It will Branch to 1004 (which is instruction 2)

- R2 = 50

R2= R1+R2 = 59

M[R3] ( M[3001]) will be updated as 59.

Address

Value

5000

10

3000

60

3001

59

3002

50

3003

50

3004

50

3005

50

3006

50

3007

50

3008

50

3009

50

3010

50

R1  = R1 - 1 => 9-1 =>8 Hence it is Nonzero; It will Branch to 1004 (which is instruction 1)

If you try to observe the Pattern

Here M[3001] is updated as 59

M[3002] will be updated as 58

M[3003] will be updated as 57

M[3004] will be updated as 56

M[3005] will be updated as 55

M[3006] will be updated as 54

M[3007] will be updated as 53

M[3008] will be updated as 52

M[3009] will be updated as 51

R1 = 0

M[3010] will be updated as 50

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...