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 1 โ€“ 10 of 222 Questions
Page 1 of 23
Q1
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.3. StackEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Describe the operation of PUSH and POP instructions with the help of an assembly language example.
๐Ÿ’ป assembly Snippet
push ax
pop bx
Q2
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Program FlowMedium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How is the value of the IP register saved and updated when a CALL instruction is executed?
๐Ÿ’ป assembly Snippet
call my_subroutine
mov ax, 1
my_subroutine:
ret
Q3
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.3. StackMedium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Given initial values AX = 0x3412, BX = 0x7856, CX = 0x1CAB, and SP = 0x0100, trace the contents of AX, BX, CX, and SP after executing: PUSH AX; PUSH BX; POP AX; POP CX.
๐Ÿ’ป assembly Snippet
; Initial: AX=0x3412, BX=0x7856, CX=0x1CAB, SP=0x0100
push ax
push bx
pop ax
pop cx
Q4
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.3. StackMedium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Given initial register values AX = 0x3412, BX = 0x7856, CX = 0x1CAB, and SP = 0x0100, trace the contents of AX, BX, CX, and SP after executing: PUSH AX; PUSH BX; XCHG AX, CX; POP CX.
๐Ÿ’ป assembly Snippet
mov ax, 0x3412
mov bx, 0x7856
mov cx, 0x1CAB
mov sp, 0x0100
push ax
push bx
xchg ax, cx
pop cx
Q5
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.3. StackEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How many parameters can a subroutine receive through the stack in x86 assembly language?
๐Ÿ’ป assembly Snippet
push param1
push param2
push param3
call my_subroutine
Q6
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. SubroutinesEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Why are procedures used in assembly language, and what must be the last executable instruction in a procedure?
๐Ÿ’ป assembly Snippet
my_proc:
    ; procedure body
    ret
Q7
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Program FlowMedium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Provide valid x86 assembly instruction(s) to move the value located at the top of the stack into the IP (Instruction Pointer) register.
๐Ÿ’ป assembly Snippet
ret
Q8
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.2. Calling ConventionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How many prevalent calling conventions exist in assembly language programming (specifically x86 CS401)?
๐Ÿ’ป assembly Snippet
push param2
push param1
call my_subroutine
add sp, 4
  1. A.1
  2. B.2
  3. C.3
  4. D.4
Q9
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.3. Modular ProgrammingMedium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In NASM assembly language, an imported symbol is declared using the ________ directive, while an exported symbol is declared using the ________ directive.
๐Ÿ’ป assembly Snippet
extern my_external_func
global my_public_func
  1. A.EXTERN directive, GLOBAL directive
  2. B.GLOBAL directive, EXTERN directive
  3. C.IMPORT directive, EXPORT directive
  4. D.PUBLIC directive, EXTERN directive
Q10
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Stack OperationsMedium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Analyze the following x86 assembly code sequence and describe its final effect on the value stored in the BP register: push bp mov bp, sp sub sp, 2 mov bp, sp pop bp
๐Ÿ’ป assembly Snippet
push bp
mov bp, sp
sub sp, 2
mov bp, sp
pop bp