📑 CHAPTER PRACTICE

CS401 - Computer Architecture and Assembly Language Programming – Subroutines

Practice 10 verified multiple choice questions per batch with instant answer reveal and comprehensive solutions.

Showing 3140 of 222 Questions
Page 4 of 23
Q31📝 Short Q📑 Lec 5MediumHigh-Yield💡Conceptual
Discuss the relationship between the subroutine instructions `CALL` and `RET` regarding whether they operate as hardware-dependent or independent operations.
💻 assembly Snippet
call my_subroutine ; Pushes IP and jumps
;
my_subroutine:
    ret ; Pops return address into IP
Q32❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
True or False: Executing the instruction `PUSH` increments the Stack Pointer (`SP`) by two before transferring a word to the top of the stack.
💻 assembly Snippet
push ax ; Decrements SP by 2, writes AX to [SS:SP]
  1. A.True
  2. B.False
Q33❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
__________ is also a stack memory base pointer register containing the address of arguments and local variables inside the stack segment.
💻 assembly Snippet
mov ax, [bp + 4] ; Accesses parameter passed on stack via BP
  1. A.SP
  2. B.BP
  3. C.PB
  4. D.AC
Q34❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The Stack Pointer register (SP) is a memory pointer that is used implicitly/indirectly by a specific set of __________ (such as `PUSH`, `POP`, `CALL`, and `RET`).
💻 assembly Snippet
push ax ; SP modified implicitly by PUSH instruction
pop  bx ; SP modified implicitly by POP instruction
  1. A.instructions
  2. B.Pointers
  3. C.Indexes
  4. D.Variables
Q35❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The Stack Pointer (SP) is a specialized memory pointer register that implicitly points to the __________.
💻 assembly Snippet
push ax ; Decrements SP by 2, pointing to new top of stack
  1. A.Top of the stack
  2. B.Bottom of the stack
  3. C.Base of the stack frame
  4. D.Start of code segment
Q36❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The `CALL` instruction takes a target memory label as an __________ and begins execution from that target location.
💻 assembly Snippet
call print_string ; 'print_string' label acts as argument
  1. A.argument
  2. B.Label
  3. C.Text
  4. D.Register
Q37❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
The __________ instruction allows temporary control flow diversion to a subroutine, enabling code reusability.
💻 assembly Snippet
call my_subroutine ; Temporarily diverts control flow to subroutine
  1. A.CALL
  2. B.RET
  3. C.AND
  4. D.XOR
Q38❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
In standard stack frame creation, executing `push bp` performs which action?
💻 assembly Snippet
push bp     ; Pushes old BP onto 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
Q39❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
When parameters are passed to a subroutine on the stack, the straightforward method to retrieve them inside the subroutine is to __________ them off the stack.
💻 assembly Snippet
pop ax ; Retrieves top parameter off the stack into AX
  1. A.PUSH
  2. B.POP
  3. C.CALL
  4. D.Register
Q40❓ MCQ📑 Lec 5Easy🔁RepeatedHigh-Yield💡Conceptual
To preserve register values across subroutine calls, the standard technique is to use __________ and __________ operations to save caller registers on the stack and restore them before returning.
💻 assembly Snippet
subroutine:
    push ax ; Save AX
    push bx ; Save BX
    ; ... subroutine work ...
    pop  bx ; Restore BX
    pop  ax ; Restore AX
    ret
  1. A.POP, ADC
  2. B.CALL, RET
  3. C.CALL, RET n
  4. D.PUSH, POP