Ch 11: Real-Time Interrupts & Timer Programming

171 Questions171 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 41 โ€“ 50 of 171 Questions
Page 5 of 18
Q41
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ 11.1. Multitasking and Multithreading (Context Switch State Saving)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In x86 assembly language multitasking concepts, fill in the blanks regarding thread context switching: During a thread context switch, the processor state consisting of __________ and __________ must be saved onto the thread's stack before switching execution.
๐Ÿ’ป assembly Snippet
; Thread Context Switch:
pusha    ; Push all general-purpose registers
pushf    ; Push FLAGS register
mov [tcb_sp], sp ; Save current SP in TCB
Q42
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ 11.1. High-Level Language Interface (NASM extern and global Modular Directives)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In NASM syntax, an imported symbol defined in an external object file is declared using the __________ directive, while an exported symbol visible to other modules is declared using the __________ directive.
๐Ÿ’ป assembly Snippet
extern _printf ; External directive for imported symbol
global _main   ; Global directive for exported symbol
  1. A.Global directive, External directive
  2. B.External directive, Global directive
  3. C.Home Directive, Foreign Directive
  4. D.Import directive, Export directive
Q43
๐Ÿง  Long Problem๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ 11.1. High-Level Language Interface (C and Assembly Pointer Interfacing)Hardโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Given the following 32-bit x86 assembly function `swap` that exchanges two integer values via pointers: ```assembly [section .text] global swap swap: mov ecx, [esp+4] ; copy parameter p1 to ecx mov edx, [esp+8] ; copy parameter p2 to edx mov eax, [ecx] ; copy *p1 into eax xchg eax, [edx] ; exchange eax with *p2 mov [ecx], eax ; copy eax into *p1 ret ; return from function ``` Write a complete C language main program that declares, links, and calls this assembly routine to swap two integer variables.
๐Ÿ’ป assembly Snippet
; Assembly Routine (swap.asm):
[section .text]
global _swap
_swap:
    mov ecx, [esp+4] ; p1 pointer
    mov edx, [esp+8] ; p2 pointer
    mov eax, [ecx]   ; eax = *p1
    xchg eax, [edx]  ; *p2 = *p1, eax = old *p2
    mov [ecx], eax   ; *p1 = old *p2
    ret
Q44
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ 11.1. High-Level Language Interface (NASM extern and global Directives)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In NASM syntax, an imported symbol defined in an external object file is declared with the __________, while an exported symbol visible to other modules is declared with the __________.
๐Ÿ’ป assembly Snippet
extern _printf ; External directive for imported symbol
global _main   ; Global directive for exported symbol
  1. A.Global directive, External directive
  2. B.External directive, Global directive
  3. C.Home Directive, Foreign Directive
  4. D.Foreign Directive, Home Directive
Q45
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ 11.1. High-Level Language Interface (32-Bit x86 Caller-Saved Scratch Registers EAX, ECX, EDX)Easyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In standard 32-bit x86 C calling conventions (cdecl / stdcall), which general-purpose registers are designated as caller-saved (scratch) registers whose values may be modified without preservation across function calls?
๐Ÿ’ป assembly Snippet
; EAX, ECX, EDX are volatile scratch registers in cdecl
; EBX, ESI, EDI, EBP, ESP are callee-saved non-volatile registers
Q46
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ Multitasking and Thread Local VariablesMediumโญ๐Ÿ’ก๐ŸŒŸ๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Which register is utilized for accessing thread-local variables in assembly language function stack frames?
๐Ÿ’ป assembly Snippet
push bp
mov bp, sp
sub sp, 2
Q47
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ Multitasking Kernel as TSRMediumโญ๐Ÿ’ก๐ŸŒŸ๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Explain the purpose of each instruction in the following code snippet taken from a Multitasking TSR caller program: `mov al, [chars+bx]` `mov [es:40], al` `inc bx`
๐Ÿ’ป assembly Snippet
mov al, [chars+bx]
mov [es:40], al
inc bx
Q48
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ Multitasking Kernel and Context SwitchingMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Define multitasking in computer systems and explain how context switching enables concurrent execution.
๐Ÿ’ป assembly Snippet
timer:
    push ax
    push bx
    ; Save context into PCB, switch tasks, restore next context
    iret
Q49
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ Multitasking Kernel and Thread ExecutionEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In a multithreaded architecture, each thread maintains its own private stack frame, enabling threads to have independent ________ function calls, parameters, and variables.
๐Ÿ’ป assembly Snippet
push bp
mov bp, sp
sub sp, 4
  1. A.Global
  2. B.Local
  3. C.Legal
  4. D.Illegal
Q50
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 11๐Ÿท๏ธ Multitasking Kernel as TSRMedium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Provide inline comments explaining the exact operation of each instruction in the following snippet taken from a Multitasking TSR caller program: `mov al, [chars+bx]` `mov [es:40], al` `inc bx`
๐Ÿ’ป assembly Snippet
mov al, [chars+bx]
mov [es:40], al
inc bx