Subroutines

Lecture 13: Subroutines

222 Questions172 MCQs45 Short Questions5 Long Questions
Showing 211220 of 222 Questions
Page 22 of 23
Q211❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
When encountered inside a subroutine, which instruction pops the saved return address off the stack and returns control to the instruction following the CALL?
💻 assembly Snippet
ret
  1. A.CALL
  2. B.RET
  3. C.AND
  4. D.XOR
Q212❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
Which two instructions are commonly used as a pair to invoke and return from subroutines, despite being technically independent in hardware operation?
  1. A.RET and ADC
  2. B.CALL and SBB
  3. C.CALL and RET
  4. D.ADC and SBB
Q213❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The subroutine CALL mechanism diverts the thread of execution and preserves general-purpose registers, automatically modifying the Stack Pointer (SP) and which control register?
  1. A.SI
  2. B.IP (Instruction Pointer)
  3. C.DI
  4. D.BP
Q214❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
If the ________ instruction is not available, clearing parameters from the stack by the callee subroutine becomes a complicated process.
💻 assembly Snippet
ret 4  ; Pops return address and adds 4 to SP to clear parameters
  1. A.CALL
  2. B.SBB
  3. C.RET n
  4. D.None of the given options
Q215❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
To preserve register values across subroutine calls, the standard programming technique is to use a pair of ________ operations to save the caller's values on the stack and restore them before returning.
💻 assembly Snippet
push ax
; ... subroutine body ...
pop ax
  1. A.POP and ADC
  2. B.CALL and RET
  3. C.CALL and RET n
  4. D.PUSH and POP
Q216❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
To access caller-passed parameters from the stack inside a subroutine, the naive initial approach that comes to mind is to ________ them off the stack.
  1. A.PUSH
  2. B.POP
  3. C.CALL
  4. D.Register
Q217❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
When executing the instruction 'PUSH BP', what specific action is performed?
💻 assembly Snippet
push bp
mov bp, sp
  1. A.Sending BP copy to stack
  2. B.Making BP copy from stack
  3. C.Pushing the current contents of base pointer register BP onto the stack
  4. D.Doing nothing
Q218❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
Local variables are defined as variables whose accessibility and lifespan are strictly restricted to a specific:
💻 assembly Snippet
sub sp, 4  ; Allocate local variables on stack frame
  1. A.Subroutine
  2. B.Program
  3. C.CALL
  4. D.Label
Q219❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The CALL mechanism diverts execution control and preserves general-purpose registers, automatically modifying the Stack Pointer (SP) and which control register?
  1. A.SI
  2. B.IP (Instruction Pointer)
  3. C.DI
  4. D.SP
Q220📝 Short Q📑 Lec 5EasyHigh-Yield💡Conceptual
What is the Destination Index (DI) register in 8086/8088 assembly language, and how is it used in string operations alongside the Extra Segment (ES) register?
💻 assembly Snippet
; Example string byte store using ES:DI
mov ax, 0x2000
mov es, ax      ; Load Extra Segment address into ES
mov di, 0x0100  ; Destination memory offset in DI
mov al, 'A'     ; ASCII character 'A'
stosb           ; Store byte AL into [ES:DI] and automatically increment DI