Computer Architecture & Assembly Language MCQs with Answers
Practice important Computer Architecture & Assembly Language MCQs with answers and explanations.
Chapter: 16
Q361:
In Pascal calling conventions, who is responsible for removing the parameters?
A. Caller
B. Callee
C. Both
D. None
Correct Answer:
B
Chapter: 16
Q362:
What naming convention does C use for function or variable names?
A. No change
B. Prepends an underscore
C. Converts to uppercase
D. Adds a prefix
Correct Answer:
B
Chapter: 16
Q363:
Which register holds the return value in both C and Pascal calling conventions?
A. EBX
B. ECX
C. EAX
D. ESP
Correct Answer:
C
Chapter: 16
Q364:
In C calling conventions, which registers must be preserved?
A. EAX, EBX, ESI
B. EAX, ESI, EDI
C. EBX, ESI, EDI, EBP, ESP, DS, ES, SS
D. ECX, EDX, FS, GS
Correct Answer:
C
Chapter: 16
Q365:
How is a function named "divide" called in assembly?
A. call divide
B. call _divide
C. call divide_func
D. call _div_func
Correct Answer:
B
Chapter: 16
Q366:
What directive can be used in C++ to enforce C style naming?
A. extern "Pascal"
B. extern "C"
C. extern "Assembly"
D. extern "Standard"
Correct Answer:
B
Chapter: 16
Q367:
What does the "extern" directive do in NASM?
A. Declares an external symbol
B. Declares a local variable
C. Declares a global symbol
D. Declares a function
Correct Answer:
A
Chapter: 16
Q368:
What command is used to assemble an assembly program into an object file in NASM?
A. nasm –f win32
B. nasm –o obj
C. nasm –c obj
D. nasm –f obj
Correct Answer:
A
Chapter: 16
Q369:
In the assembly function _swap, what does the instruction mov ecx,[esp+4] do?
A. Copies parameter p1 to ecx
B. Copies parameter p2 to ecx
C. Copies the return value to ecx
D. Copies the address of p1 to ecx
Correct Answer:
A
Chapter: 16
Q370:
What is the purpose of the add esp, 8 instruction in the assembly code calling a C function?
A. Allocates stack space
B. Clears the stack
C. Increments the stack pointer by 8
D. Decrements the stack pointer by 8
Correct Answer:
B
Chapter: 16
Q371:
What happens when optimizations are turned on in the gcc compiler?
A. Fewer instructions are generated
B. More instructions are generated
C. Assembly code becomes slower
D. Memory accesses increase
Correct Answer:
A
Chapter: 16
Q372:
How does the assembly function _swap differ when compiled with optimizations versus without?
A. Uses fewer instructions
B. Uses more instructions
C. Performs the same number of memory accesses
D. Uses more registers
Correct Answer:
A
Chapter: 16
Q373:
In the optimized version of the _swap function, which register is used to temporarily store a value?
A. EAX
B. EBX
C. ECX
D. ESI
Correct Answer:
B
Chapter: 16
Q374:
Which function should be implemented in assembly to traverse a linked list and call a C function for each node?
A. swap
B. printnode
C. printlist
D. traverse
Correct Answer:
C
Chapter: 16
Q375:
What is the role of the ret instruction in an assembly function?
A. Initializes the stack
B. Returns from the function
C. Calls another function
D. Exits the program
Correct Answer:
B
Chapter: 16
Q376:
How can a hand-optimized assembly version of a function improve performance?
A. By reducing the number of instructions
B. By adding more memory accesses
C. By increasing the size of the code
D. By adding more loops
Correct Answer:
A
Chapter: 17
Q377:
Which processors are popular in high-performance embedded applications?
A. Intel x86
B. Sun SPARC
C. Motorolla 68K
D. AMD Ryzen
Correct Answer:
C
Chapter: 17
Q378:
What type of architecture does the Motorolla 68K processor have?
A. 32-bit architecture
B. 16-bit architecture
C. 64-bit architecture
D. 23-bit architecture
Correct Answer:
A
Chapter: 17
Q379:
What is the size of the condition code register (CCR) in Motorolla 68K processors?
A. 8-bit
B. 16-bit
C. 32-bit
D. 64-bit
Correct Answer:
A
Chapter: 17
Q380:
How many general-purpose registers does the Motorolla 68K processor have?
A. 8
B. 12
C. 16
D. 32
Correct Answer:
C