Ch 16: Interfacing Assembly with C/C++

69 Questions69 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 69 Questions
Page 3 of 7
Q21
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ Function Calling ConventionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How many predominant function calling conventions (cdecl and stdcall) are commonly utilized when interfacing high-level programming languages with assembly routines?
  1. A.1
  2. B.2
  3. C.3
  4. D.4
Q22
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ NASM Assembly Modular DirectivesEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In NASM assembly syntax, an imported symbol defined in another module is declared using the ________ directive, while an exported symbol made visible to other modules is declared using the ________ directive.
๐Ÿ’ป assembly Snippet
extern _printf
global _main
  1. A.GLOBAL directive, EXTERN directive
  2. B.EXTERN directive, GLOBAL directive
  3. C.HOME directive, FOREIGN directive
  4. D.FOREIGN directive, HOME directive
Q23
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ NASM Assembly Modular DirectivesEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In NASM assembly syntax, an imported symbol defined in an external module is declared using the ________ directive, while an exported symbol made visible to other modules is declared using the ________ directive.
๐Ÿ’ป assembly Snippet
extern _printf
global _main
  1. A.GLOBAL directive, EXTERN directive
  2. B.EXTERN directive, GLOBAL directive
  3. C.HOME directive, FOREIGN directive
  4. D.FOREIGN directive, HOME directive
Q24
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ Function Calling Conventions and Stack CleanupEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In the stdcall / Pascal function calling convention, clearing parameters off the stack frame after subroutine execution is performed by the ________.
๐Ÿ’ป assembly Snippet
ret 4
  1. A.Caller
  2. B.Callee
  3. C.Interrupt Vector
  4. D.Operating System
Q25
๐Ÿง  Long Problem๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ Interfacing C with Assembly Language RoutinesHardโญ๐Ÿ’ก๐ŸŒŸ๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Given the following 32-bit x86 NASM assembly subroutine 'swap' that exchanges two integer values via pointer arguments on the stack, write a complete C main program that prototype-declares and invokes this assembly function. ```assembly [section .text] global swap swap: mov ecx, [esp+4] ; Copy pointer p1 into ECX mov edx, [esp+8] ; Copy pointer p2 into EDX mov eax, [ecx] ; Load *p1 into EAX xchg eax, [edx] ; Exchange EAX with *p2 mov [ecx], eax ; Write updated value back to *p1 ret ; Return to C caller ```
๐Ÿ’ป assembly Snippet
[section .text]
global swap
swap:
    mov ecx, [esp+4]
    mov edx, [esp+8]
    mov eax, [ecx]
    xchg eax, [edx]
    mov [ecx], eax
    ret
Q26
๐Ÿง  Long Problem๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ Interfacing C with Assembly Language RoutinesHardโญ๐Ÿ’ก๐ŸŒŸ๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Write a complete C main program that links with and invokes the 32-bit x86 NASM assembly subroutine 'swap' to exchange two integer variables, and specify the command used to assemble the NASM source file.
๐Ÿ’ป assembly Snippet
nasm -f win32 swap.asm -o swap.obj
Q27
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ Motorola 68K Processor Architecture and Program CounterEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In Motorola 68K processors, what is the 32-bit register that holds the address of the currently executing instruction?
  1. A.Program Counter (PC)
  2. B.Stack Pointer (SP)
  3. C.Address Register
  4. D.Status Register
Q28
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ Motorola 68K Architecture and Program CounterEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In Motorola 68K processors, what is the bit-width of the Program Counter (PC) register that holds the address of the currently executing instruction?
  1. A.8-bit
  2. B.16-bit
  3. C.32-bit
  4. D.64-bit
Q29
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ Motorola 68K Architecture and Register SetEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In Motorola 68K processors, what is the bit-width of the general-purpose registers?
  1. A.4-bit
  2. B.8-bit
  3. C.16-bit
  4. D.32-bit
Q30
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 16๐Ÿท๏ธ Motorola 68K General-Purpose RegistersEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How many general-purpose registers (data registers and address registers combined) are available in Motorola 68K processors?
  1. A.4
  2. B.8
  3. C.16
  4. D.32