GATE CS 2021 Set 1 — Question 65
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+2 / -0HardInstruction FormatsInstructions & Addressing ModesComputer Organization & ArchitectureAddressing Modes
Computer Organization & Architecture → Instructions & Addressing Modes → Addressing Modes
Last updated
Question
Consider the following instruction sequence where registers R1, R2 and R3 are general purpose and MEMORY[X] denotes the content at the memory location X.
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 __________.
| 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 |
Correct answer
50 to 50
Solution
Lay out the program in memory (start address 1000, byte addressable):
So
| Address | Instruction | Size |
|---|---|---|
| 1000 | MOV R1, (5000) | 4 |
| 1004 | MOV R2, (R3) | 4 |
| 1008 | ADD R2, R1 | 2 |
| 1010 | MOV (R3), R2 | 4 |
| 1014 | INC R3 | 2 |
| 1016 | DEC R1 | 2 |
| 1018 | BNZ 1004 | 2 |
| 1020 | HALT | 1 |
BNZ 1004 jumps back to MOV R2, (R3); the instruction at 1000 runs only once.- Initially and .
- Each pass of the loop does , then and .
- The loop body runs while after the decrement, i.e. for : exactly 10 passes.
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Instructions & Addressing Modes
2026 Set 1 Q14Match each addressing mode in List I with a data element or an element of a data structure (in…2026 Set 1 Q15Consider a processor P whose instruction set architecture is the load-store architecture. The…2026 Set 1 Q16Which one of the following dependencies among the register operands of different instructions can…2026 Set 2 Q18Consider the following two statements about interrupt handling mechanisms in a CPU. S1: In…2026 Set 1 Q38The size of the physical address space of a processor is bytes. The capacity of a cache…