Subroutines

Lecture 13: Subroutines

222 Questions172 MCQs45 Short Questions5 Long Questions
Showing 91100 of 222 Questions
Page 10 of 23
Q91📝 Short Q📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
Describe the working mechanics of the `CALL` instruction in relation to the stack data structure.
💻 assembly Snippet
; CALL mechanics:
; 1. SP = SP - 2
; 2. [SS:SP] = IP (Return Address)
; 3. IP = target_label_offset
Q92❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
Which x86 instruction transfers the word at the current top of the stack (pointed to by `SS:SP`) to the destination operand and then increments `SP` by two?
💻 assembly Snippet
pop ax ; Copies [SS:SP] into AX, then increments SP by 2
  1. A.push
  2. B.pop
  3. C.call
  4. D.none of given
Q93❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
True or False: The `RET` instruction does NOT pop the word at the top of the stack (pointed to by `SS:SP`) into the Instruction Pointer, but merely increments `SP` by two.
💻 assembly Snippet
ret ; Pops top of stack into IP, restoring execution flow
  1. A.true
  2. B.false
Q94❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
True or False: The operations for placing items onto the stack and removing them from the stack are called `push` and `ret`.
💻 assembly Snippet
push ax ; Pushes item onto stack
pop bx  ; Removes item from stack
  1. A.true
  2. B.false
Q95❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
True or False: The operation of `push ax` increments the Stack Pointer by 2 (`SP <- SP + 2`) before moving `AX` to `[SS:SP]`.
💻 assembly Snippet
push ax ; Performs SP = SP - 2, then [SS:SP] = AX
  1. A.true
  2. B.false
Q96❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
In standard x86 subroutine parameter cleanup mechanisms using the `RET n` instruction, parameters are removed from the stack by the __________.
💻 assembly Snippet
ret 4 ; Callee pops return address and adds 4 to SP to remove parameters
  1. A.caller
  2. B.callee
  3. C.caller and callee
  4. D.none of given
Q97❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The Stack Pointer (`SP`) is a dedicated memory pointer register that is manipulated implicitly by a set of stack __________ (such as `PUSH`, `POP`, `CALL`, and `RET`).
💻 assembly Snippet
push ax ; Implicitly decrements SP by 2
pop bx  ; Implicitly increments SP by 2
  1. A.instructions
  2. B.Pointers
  3. C.Indexes
  4. D.Variables
Q98❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
In addition to `SP`, which memory pointer register is specifically designed to access parameter data and local variables stored in the stack frame?
💻 assembly Snippet
mov bp, sp
mov ax, [bp + 4] ; Accesses parameter passed on stack
  1. A.SP
  2. B.BP
  3. C.PB
  4. D.AC
Q99❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
Which x86 assembly instruction allows temporary diversion of execution flow to a subroutine, enabling modularity and reusability of code?
💻 assembly Snippet
call my_subroutine ; Temporarily diverts execution to subroutine
  1. A.CALL
  2. B.RET
  3. C.AND
  4. D.XOR
Q100❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The `CALL` instruction accepts a target subroutine label as its __________ and begins execution from that label address.
💻 assembly Snippet
call print_string ; 'print_string' label acts as the argument
  1. A.argument
  2. B.Lable
  3. C.TXt
  4. D.Register