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 21 โ€“ 30 of 222 Questions
Page 3 of 23
Q21
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. String Instructions (STOSB and Direction Flag)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In string instructions like STOSB, when the Direction Flag (DF) is clear (DF = 0), how is the Destination Index (DI) register modified?
๐Ÿ’ป assembly Snippet
CLD
STOSB
  1. A.Incremented by 1
  2. B.Incremented by 2
  3. C.Decremented by 1
  4. D.Decremented by 2
Q22
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. String Operations and Repeat Prefixes (REP STOSW)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
When executing string instructions with the repeat prefix (e.g., `REP STOSW`), how is the Count Register (CX) modified after each iteration?
๐Ÿ’ป assembly Snippet
REP STOSW
  1. A.Decremented by 1
  2. B.Decremented by 2
  3. C.Incremented by 1
  4. D.Incremented by 2
Q23
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. String Instructions (STOSB Index Register Pointer Update)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In the STOSB (Store String Byte) instruction, by how many bytes is the index register modified (incremented or decremented depending on the Direction Flag)?
๐Ÿ’ป assembly Snippet
STOSB
  1. A.1
  2. B.2
  3. C.3
  4. D.4
Q24
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Program FlowEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What assembly language instructions are used to perform permanent (unconditional) and temporary (subroutine) program execution diversions?
๐Ÿ’ป assembly Snippet
jmp permanent_label ; Permanent diversion
call subroutine_label ; Temporary diversion
Q25
๐Ÿง  Long Problem๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.6. Local VariablesHardโญ๐Ÿ’ก๐ŸŒŸ๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Describe the concept, stack implementation, lifecycle, and scope of local variables in assembly language subroutines.
๐Ÿ’ป assembly Snippet
push bp
mov bp, sp
sub sp, 4 ; Allocates 4 bytes for local variables
Q26
๐Ÿง  Long Problem๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.6. Local Variables and Stack Frame ManagementHardโญ๐Ÿ’ก๐ŸŒŸ๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Explain how local variables (such as 'swapflag' in bubble sort) are created, accessed, and managed on the stack frame during subroutine execution in x86 assembly language.
๐Ÿ’ป assembly Snippet
push bp
mov bp, sp
sub sp, 2 ; Allocates 2 bytes (1 word) for local variable 'swapflag'
Q27
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (PUSH Register Non-Destructive Mechanics)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What happens to the register `AX` upon executing the assembly instruction `PUSH AX`?
๐Ÿ’ป assembly Snippet
push ax ; Decrements SP by 2 and copies contents of AX to [SS:SP]
  1. A.AX register will reside on the stack
  2. B.A copy of AX will go on the stack
  3. C.The value of AX disappears after moving on stack
  4. D.Stack will send an acceptance message
Q28
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (SS:SP Addressing)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The 20-bit physical memory address of the stack top is computed using which segment and offset register pair?
  1. A.SS:SP combination
  2. B.SS:SI combination
  3. C.ES:BP combination
  4. D.ES:SP combination
Q29
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (PUSH Execution Mechanics)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
When an item is pushed onto a standard downward-growing x86 stack, how does the Stack Pointer (`SP`) operate relative to copying data?
  1. A.First decremented and then element copied on to the stack
  2. B.First incremented and then element copied on to the stack
  3. C.Decremented after the element copied on to the stack
  4. D.Incremented after the element copied on to the stack
Q30
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (CALL and RET Relationship)Mediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
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