Subroutines

Lecture 13: Subroutines

222 Questions172 MCQs45 Short Questions5 Long Questions
Showing 111120 of 222 Questions
Page 12 of 23
Q111❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
To access arguments passed on the stack inside a subroutine, the immediate or naive idea that comes to mind is to __________ them off the stack.
💻 assembly Snippet
; Accessing parameters by popping removes them from stack
  1. A.PUSH
  2. B.POP
  3. C.CALL
  4. D.Register
Q112❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
When executing the assembly instruction `push bp`, what operation is being performed?
💻 assembly Snippet
push bp ; Saves previous BP on top of stack
mov bp, sp ; Sets up new stack frame pointer
  1. A.sending bp copy to stack
  2. B.making bp copy from stack
  3. C.pushing bp on the stack
  4. D.doing nothing
Q113❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
In computer programming and assembly language, 'local variables' refer to temporary variables that are declared and used strictly within a __________.
💻 assembly Snippet
sub sp, 4 ; Allocates 4 bytes for local variables on subroutine stack frame
  1. A.Subroutine
  2. B.Program
  3. C.CALL
  4. D.Label
Q114❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The `RETF` (Return Far) instruction restores program execution by popping the offset address into register `IP` and the segment address into which segment register?
💻 assembly Snippet
retf ; Pops IP first, then pops CS off stack
  1. A.CS register
  2. B.DS register
  3. C.SS register
  4. D.ES register
Q115❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
By default, the Stack Pointer (`SP`) register is associated with which segment register?
  1. A.SS
  2. B.DS
  3. C.CS
  4. D.ES
Q116❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The `RETF` (Return Far) instruction pops the 16-bit target instruction offset into which register?
💻 assembly Snippet
retf ; Pops IP first, then pops CS off stack
  1. A.BP
  2. B.IP
  3. C.SP
  4. D.SI
Q117❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
After the execution of the near return instruction `RET 2`, what is the total change applied to the Stack Pointer (`SP`)?
💻 assembly Snippet
ret 2 ; Pops 2-byte IP (SP += 2) and removes 2 parameter bytes (SP += 2) -> Total SP += 4
  1. A.SP is incremented by 2
  2. B.SP is decremented by 2
  3. C.SP is incremented by 4
  4. D.SP is decremented by 4
Q118❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
In 8088 architecture, whenever an element is pushed onto the stack, how is the Stack Pointer (`SP`) modified?
💻 assembly Snippet
push ax ; SP = SP - 2, then [SS:SP] = AX
  1. A.SP is decremented by 1
  2. B.SP is decremented by 2
  3. C.SP is decremented by 3
  4. D.SP is decremented by 4
Q119📝 Short Q📑 Lec 5MediumHigh-Yield💡Conceptual
Explain the concept of Incrementing and Decrementing Stack operations in x86 microprocessor architecture.
💻 assembly Snippet
; PUSH: SP decrements by 2 (top-down stack growth)
; POP:  SP increments by 2 (stack unwinding)
Q120📝 Short Q📑 Lec 5EasyHigh-Yield💡Conceptual
Can single 8-bit bytes be directly pushed onto or popped off the stack in Intel 8088 assembly language? Explain the stack element size constraint.
💻 assembly Snippet
; Valid:   push ax   ; Pushes 16-bit word
; Invalid: push al   ; Syntax Error (8-bit registers cannot be pushed)