Ch 05: Subroutines and Stack Architecture

222 Questions222 MCQs0 Short Questions0 Long Questions
๐ŸŽฏ Exam Practice Papers
SEMESTER PASS

CS401 - Computer Architecture and Assembly Language Programming Examination Practice

Timed practice exam simulation for CS401 - Computer Architecture and Assembly Language Programming.

๐Ÿ“˜ VU MID TERM EXAMLectures 1 to 22
โฑ๏ธ 60 Mins

Mid Term Examination

Covers syllabus of Lectures 1 to 22 with 30 high-yield MCQs in a timed exam environment.

๐Ÿ“30 MCQs
โฑ๏ธ60 Minutes
๐Ÿ“— VU FINAL TERM EXAMLectures 23 to 45
โฑ๏ธ 90 Mins

Final Term Examination

Comprehensive semester exam preparation with 45 MCQs covering Lectures 23 to 45 with complete course coverage.

๐Ÿ“45 MCQs
โฑ๏ธ90 Minutes
Showing 71 โ€“ 80 of 222 Questions
Page 8 of 23
Q71
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (Stack Overflow Condition)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
When the stack becomes completely filled with data such that `SP` decrements down to 0 and wraps around, corrupting existing data, this condition is known as stack __________.
  1. A.Overflow
  2. B.Leakage
  3. C.Error
  4. D.Pointer
Q72
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (POP Instruction Mechanics)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The `POP` instruction copies the word from the top of the stack (`[SS:SP]`) into its specified __________ and then increments the Stack Pointer (`SP`) by 2.
๐Ÿ’ป assembly Snippet
pop ax ; Copies [SS:SP] into destination register AX, then SP = SP + 2
  1. A.destination operand (register or memory)
  2. B.source operand
  3. C.instruction pointer
  4. D.flag register
Q73
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (PUSH Instruction Operation Mechanics)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Which x86 instruction decrements the Stack Pointer (`SP`) by 2 and then transfers a 16-bit 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
Q74
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (POP Instruction Stack Pointer Increment)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The `POP` instruction transfers the word at the top of the stack (pointed to by `SS:SP`) into 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.--
Q75
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (Register Preservation via PUSH and POP)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
To preserve register values across subroutine calls, the standard programming convention is to use __________ operations to save caller register values prior to subroutine execution and restore them upon return.
๐Ÿ’ป assembly Snippet
my_func:
  push ax ; Save register state
  push bx
  ; ... subroutine body ...
  pop  bx ; Restore register state
  pop  ax
  ret
  1. A.POP, ADC
  2. B.CALL, RET
  3. C.CALL, RET n
  4. D.PUSH, POP
Q76
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (Retrieving Stack Arguments via POP)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
To access subroutine arguments 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
Q77
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (Standard Stack Frame Prologue push bp)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In standard x86 subroutine stack frame initialization, what is accomplished by executing the instruction `push bp`?
๐Ÿ’ป assembly Snippet
push bp ; Saves caller's BP on 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
Q78
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (Local Variable Scope and Allocation)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Local variables in assembly language programming are defined as temporary variables whose scope and lifetime are restricted to the __________.
๐Ÿ’ป assembly Snippet
push bp
mov bp, sp
sub sp, 4 ; Allocates space for local variables on stack
  1. A.Subroutine
  2. B.Program
  3. C.CALL
  4. D.Label
Q79
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (RET Subroutine Return Execution)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
When the __________ instruction is encountered in a subroutine, program execution is transferred back to the instruction immediately following the `CALL` instruction.
๐Ÿ’ป assembly Snippet
ret ; Pops return address from stack into IP
  1. A.CALL
  2. B.RET
  3. C.AND
  4. D.XOR
Q80
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (POP Instruction Operand)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The `POP` operation reads a word from the top of the stack (`[SS:SP]`) and copies it into its __________.
๐Ÿ’ป assembly Snippet
pop ax ; Copies top of stack to destination register operand AX
  1. A.Register
  2. B.operand
  3. C.RET n
  4. D.Pointer