Subroutines

Lecture 13: Subroutines

222 Questions172 MCQs45 Short Questions5 Long Questions
Showing 8190 of 222 Questions
Page 9 of 23
Q81❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
Which instruction decrements the Stack Pointer (`SP`) by 2 and then transfers a word from the source operand onto the top of the stack?
💻 assembly Snippet
push ax ; Decrements SP by 2, then copies AX to [SS:SP]
  1. A.PUSH
  2. B.POP
  3. C.CALL
  4. D.RET
Q82❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The `POP` instruction transfers the word at the top of the stack (pointed to by `SS:SP`) to the destination operand and then __________ `SP` by two to point to the new top of stack.
💻 assembly Snippet
pop ax ; Copies [SS:SP] to AX, then increments SP by 2
  1. A.increments
  2. B.decrements
  3. C.'++
  4. D.'--
Q83❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
To preserve register state across subroutines, the standard convention is to use __________ operations to save caller register values on the stack and recover them prior to returning.
💻 assembly Snippet
my_func:
  push ax ; Save register state
  ; ... subroutine body ...
  pop  ax ; Restore register state
  ret
  1. A.POP, ADC
  2. B.CALL, RET
  3. C.CALL, RET n
  4. D.PUSH, POP
Q84❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
To access subroutine parameters passed on the stack, an immediate (though destructive) method is to __________ them off the stack into general registers.
💻 assembly Snippet
pop ax ; Retrieves top argument from stack
  1. A.PUSH
  2. B.POP
  3. C.CALL
  4. D.Register
Q85❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
In 8088 real mode, the 20-bit physical memory address of the stack is calculated using which register combination?
💻 assembly Snippet
; Physical Stack Address = (SS * 16) + SP
  1. A.SS:SI combination
  2. B.SS:SP combination
  3. C.ES:BP combination
  4. D.ES:SP combination
Q86❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
In 8088 architecture, what is the maximum number of word parameters a subroutine can receive via registers when all general-purpose registers (AX, BX, CX, DX, SI, DI, BP) are utilized?
  1. A.7
  2. B.6
  3. C.5
  4. D.4
Q87❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
True or False: The hardware/assembly operations for placing items onto the stack and removing them from the stack are called `PUSH` and `RET`.
💻 assembly Snippet
push ax ; Places item on stack
pop bx  ; Removes item from stack
  1. A.True
  2. B.False
Q88❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
True or False: The `PUSH` instruction increments the Stack Pointer (`SP`) by two and then transfers a word from the source operand onto the top of the stack.
💻 assembly Snippet
push ax ; Decrements SP by 2, then copies AX to [SS:SP]
  1. A.TRUE
  2. B.FALSE
Q89❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
In 8088 real mode, the 20-bit physical memory address of the stack top is computed using which segment and register pair?
💻 assembly Snippet
; Physical Address = (SS * 16) + SP
  1. A.SS:SP combination
  2. B.SS:SI combination
  3. C.ES:BP combination
  4. D.ES:SP combination
Q90❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
After the execution of a simple near `RET` instruction in a subroutine, how is the Stack Pointer (`SP`) modified?
💻 assembly Snippet
ret ; Pops 2-byte IP off stack and increments SP by 2
  1. A.SP is incremented by 2
  2. B.SP is decremented by 2
  3. C.SP is incremented by 1
  4. D.SP is decremented by 1