Microprocessors · Digital Electronics
22 questions · asked in 13 of 26 years (2001–2026)
MCQ 20 · NAT 21-mark 18 · 2-mark 4
2001Questions per year2026
Questions 6–10 of 22
A portion of the main program to call a subroutine SUB in an 8085 environment
is given below.
:
:
LXI D, DISP
LP : CALL SUB
:
:
It is desired that control be returned to LP+DISP+3 when the RET instruction
is executed in the subroutine. The set of instructions that precede the RET
instruction in the subroutine areAnswer: (C)
CALL SUB uses 3 address locations and pushes its return address, LP+3, on the stack. So a plain RET goes back to LP+3. LXI D, DISP has put DISP in the DE pair.
To return to LP+DISP+3, the subroutine must add DISP to the return address stored at the top of the stack (SP):
POP H : HL = LP+3 (the return address comes off the stack)
DAD D : HL = HL + DE = LP+3+DISP
PUSH H : the new return address goes back on the stack, so RET loads PC = LP+DISP+3
The normal call operation is shown here.
Why the others fail: in (A), POP D overwrites DISP in DE with LP+3, DAD H doubles HL, and PUSH D puts back LP+3, so RET returns to LP+3. In (B) the extra three INX H give LP+DISP+6. In (D), XTHL swaps HL with the top of the stack, INX D changes only DE, and the second XTHL swaps back, so the stack still holds LP+3.
Answer: (C)
To return to LP+DISP+3, the subroutine must add DISP to the return address stored at the top of the stack (SP):
POP H : HL = LP+3 (the return address comes off the stack)
DAD D : HL = HL + DE = LP+3+DISP
PUSH H : the new return address goes back on the stack, so RET loads PC = LP+DISP+3
The normal call operation is shown here.
Why the others fail: in (A), POP D overwrites DISP in DE with LP+3, DAD H doubles HL, and PUSH D puts back LP+3, so RET returns to LP+3. In (B) the extra three INX H give LP+DISP+6. In (D), XTHL swaps HL with the top of the stack, INX D changes only DE, and the second XTHL swaps back, so the stack still holds LP+3.
Answer: (C)
When a "CALL Addr" instruction is executed, the CPU carries out the following sequential operations internally :
Note: (R) means content of register R
((R)) means content of memory location pointed to by R.
PC means Program Counter
SP means Stack Pointer
Note: (R) means content of register R
((R)) means content of memory location pointed to by R.
PC means Program Counter
SP means Stack Pointer
Answer: (D)
CALL must save the return address (the PC, which already points to the next instruction) before it loads the PC with the call address Addr. If the PC were loaded with Addr first, the return address would be lost.
So the correct order is:
1. , store the return address on the stack
2. (SP) is moved on to the next stack location (incremented, in the stack model used in this question)
3. , jump to the subroutine
In (A), (B) and (C), the PC is loaded with Addr before the store, so Addr, and not the return address, is pushed. Only (D) stores first.
Answer: (D)
So the correct order is:
1. , store the return address on the stack
2. (SP) is moved on to the next stack location (incremented, in the stack model used in this question)
3. , jump to the subroutine
In (A), (B) and (C), the PC is loaded with Addr before the store, so Addr, and not the return address, is pushed. Only (D) stores first.
Answer: (D)
In an 8085 microprocessor, the contents of the Accumulator, after the following instructions are executed will become
XRA A
MVI B, F0 H
SUB B
XRA A
MVI B, F0 H
SUB B
Answer: (D)
- XRA A:
- MVI B, F0H:
- SUB B:
The subtraction is carried out by adding the 2's complement. The 2's complement of F0H (1111 0000) is 0001 0000 = 10H.
So we get (a borrow is generated, so CY = 1).
The accumulator ends up with 10H.
Correct answer: (D)The increasing order of speed of data access for the following device is
(I) Cache Memory
(II) CD-ROM
(III) Dynamic RAM
(IV) Processor Registers
(V) Magnetic Tape
(I) Cache Memory
(II) CD-ROM
(III) Dynamic RAM
(IV) Processor Registers
(V) Magnetic Tape
Answer: (B)
Speed of access, from slowest to fastest:
(V) Magnetic tape: access is sequential, so the tape must be wound to the data. This is the slowest.
(II) CD-ROM: optical disk with direct access, so it is much faster than tape but still slow because of mechanical movement.
(III) Dynamic RAM: electronic memory, much faster than any disk.
(I) Cache memory: built from SRAM and placed close to the processor, so it is faster than DRAM.
(IV) Processor registers: inside the CPU itself, so they are accessed without any memory cycle. This is the fastest.
Increasing order of speed: (V), (II), (III), (I), (IV).
Answer: (B)
(V) Magnetic tape: access is sequential, so the tape must be wound to the data. This is the slowest.
(II) CD-ROM: optical disk with direct access, so it is much faster than tape but still slow because of mechanical movement.
(III) Dynamic RAM: electronic memory, much faster than any disk.
(I) Cache memory: built from SRAM and placed close to the processor, so it is faster than DRAM.
(IV) Processor registers: inside the CPU itself, so they are accessed without any memory cycle. This is the fastest.
Increasing order of speed: (V), (II), (III), (I), (IV).
Answer: (B)
The content of some of the memory location in an 8085 accumulator based system
are given below
The content of stack (SP), program counter (PC) and (H,L) are 2700H, 2100H and 0000H respectively. When the following sequence of instruction are executed.
2100 H: DAD SP
2101 H: PCHL
the content of (SP) and (PC) at the end of execution will be
The content of stack (SP), program counter (PC) and (H,L) are 2700H, 2100H and 0000H respectively. When the following sequence of instruction are executed.
2100 H: DAD SP
2101 H: PCHL
the content of (SP) and (PC) at the end of execution will be
Answer: (B)
Given values:
(SP) = 2700H
(PC) = 2100H
(HL) = 0000H
Instruction at 2100H is DAD SP.
It adds SP and HL: (SP) + (HL) (HL)
2700H + 0000H = 2700H, and this result goes into the HL pair. DAD does not change SP.
Instruction at 2101H is PCHL. It copies the content of HL into PC.
So now (PC) = 2700H, and (SP) stays the same. The memory contents in the table are not used, because neither instruction reads memory or the stack.
(PC) = 2700H
(SP) = 2700H
Option (A) would be right only if PCHL simply moved on to the next instruction. Options (C) and (D) assume stack operations that DAD SP and PCHL do not do.
Answer: (B)
(SP) = 2700H
(PC) = 2100H
(HL) = 0000H
Instruction at 2100H is DAD SP.
It adds SP and HL: (SP) + (HL) (HL)
2700H + 0000H = 2700H, and this result goes into the HL pair. DAD does not change SP.
Instruction at 2101H is PCHL. It copies the content of HL into PC.
So now (PC) = 2700H, and (SP) stays the same. The memory contents in the table are not used, because neither instruction reads memory or the stack.
(PC) = 2700H
(SP) = 2700H
Option (A) would be right only if PCHL simply moved on to the next instruction. Options (C) and (D) assume stack operations that DAD SP and PCHL do not do.
Answer: (B)
Keep practising