CSCI3130 FINAL EXAM 2025/2026
QUESTIONS AND ANSWERS 100% PASS
Why do you need to make register rax 0 before calling C inbuilt function: printf? - ANS printf
uses a variable number of arguments and rax specifies how many SSE registers (for floating-
points) are used for the arguments. In our case we don't use any.
Major difference between high-level language vs low-level languages? - ANS High level
languages have a high level of abstraction from the hardware.
Explain the term abstraction in regards to programming languages? - ANS Making a sandwich
-- High level of abstraction: push a button to make a sandwich. No need to know any details of
how to make sandwich
-- Low level of abstraction: need to know how to place the components of the sandwich, where
should the bread go, where should the cheese go and so on.
-- No level of abstraction can be should be able to make bread, cheese and other components.
What are the advantages of learning assembly language? - ANS • Some architectures don't
have C compilers...
-- Instead, they have embedded systems and/or micro-controllers
• Writing compilers
• Real speedups
• Develop a better understanding of how the processor/compiler/language functions
1 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED
,How many general-purpose registers are there in x86_64 processor? - ANS 16
Why do you need to make register rdx 0 before division? - ANS Any non- zero number will
make the dividend {rdx,rax} a very large number.
What happens to rdx and rax after the mul instruction? - ANS -Leftmost 64 bits of the result
are stored in rdx
-Rightmost 64 bits of the results are stored in rax
How do we recognize comments in assembly code? - ANS Semicolon (;)
What does "global" assembler directive do? - ANS Allows assembly functions and labels to be
accessible to code in other object files (.o)
System calls are performed using which instruction? - ANS syscall
What instruction is used to call assembly functions, as well as external (C, C++, Fortran)
functions? - ANS call
Distinguish between section .text and section .data. - ANS Executable assembly instructions
are typically placed in the .text section and static data/variable declarations are placed in the
.data section
Syscall argument order: - ANS rdi, rsi, rdx, r10, r8, r9
Function argument order: - ANS rdi, rsi, rdx, rcx, r8, r9
2 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED
, Distinguish between db, dw, dd, and dq. - ANS •db = 1 byte or 8 bits
•dw = 2 bytes (word) or 16 bits
•dd = 4 bytes (double word) or 32 bit
•dq = 8 bytes (quadword) or 64 bits
f register rsi = 10 and rdx = 16, what would be the value of rax after the following instruction?
lea rax, [rdx+rsi*8] - ANS 96
Let's assume the following array "Array" with 16 64-bit integers:
Array: dq 3, 5, 9, 81, 13, 2, 6, 24, 33, 21, 19, 40, 93, 48, 91, 78
Using the array "Array" answer what value is moved to the %rax register based on the following
instructions:
mov rdi, 5
mov rax, Array[rdi*8] - ANS 2
The value of the following registers are preserved by convention (all other registers are NOT
guaranteed to retain their prior values after a function call): - ANS RSP, RBP, RBX, R12, R13,
R14, R15
Let's assume rcx = 0x1F5 and rax= 0xC3F.
What's in rax after the following operation:
OR rax, rcx - ANS 0xDFF
Let's assume rcx = 1F5 and rax= C3F (Hexadecimal representation). What is the value in rcx after
the following instruction:
OR rcx, rax - ANS DFF
3 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED
QUESTIONS AND ANSWERS 100% PASS
Why do you need to make register rax 0 before calling C inbuilt function: printf? - ANS printf
uses a variable number of arguments and rax specifies how many SSE registers (for floating-
points) are used for the arguments. In our case we don't use any.
Major difference between high-level language vs low-level languages? - ANS High level
languages have a high level of abstraction from the hardware.
Explain the term abstraction in regards to programming languages? - ANS Making a sandwich
-- High level of abstraction: push a button to make a sandwich. No need to know any details of
how to make sandwich
-- Low level of abstraction: need to know how to place the components of the sandwich, where
should the bread go, where should the cheese go and so on.
-- No level of abstraction can be should be able to make bread, cheese and other components.
What are the advantages of learning assembly language? - ANS • Some architectures don't
have C compilers...
-- Instead, they have embedded systems and/or micro-controllers
• Writing compilers
• Real speedups
• Develop a better understanding of how the processor/compiler/language functions
1 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED
,How many general-purpose registers are there in x86_64 processor? - ANS 16
Why do you need to make register rdx 0 before division? - ANS Any non- zero number will
make the dividend {rdx,rax} a very large number.
What happens to rdx and rax after the mul instruction? - ANS -Leftmost 64 bits of the result
are stored in rdx
-Rightmost 64 bits of the results are stored in rax
How do we recognize comments in assembly code? - ANS Semicolon (;)
What does "global" assembler directive do? - ANS Allows assembly functions and labels to be
accessible to code in other object files (.o)
System calls are performed using which instruction? - ANS syscall
What instruction is used to call assembly functions, as well as external (C, C++, Fortran)
functions? - ANS call
Distinguish between section .text and section .data. - ANS Executable assembly instructions
are typically placed in the .text section and static data/variable declarations are placed in the
.data section
Syscall argument order: - ANS rdi, rsi, rdx, r10, r8, r9
Function argument order: - ANS rdi, rsi, rdx, rcx, r8, r9
2 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED
, Distinguish between db, dw, dd, and dq. - ANS •db = 1 byte or 8 bits
•dw = 2 bytes (word) or 16 bits
•dd = 4 bytes (double word) or 32 bit
•dq = 8 bytes (quadword) or 64 bits
f register rsi = 10 and rdx = 16, what would be the value of rax after the following instruction?
lea rax, [rdx+rsi*8] - ANS 96
Let's assume the following array "Array" with 16 64-bit integers:
Array: dq 3, 5, 9, 81, 13, 2, 6, 24, 33, 21, 19, 40, 93, 48, 91, 78
Using the array "Array" answer what value is moved to the %rax register based on the following
instructions:
mov rdi, 5
mov rax, Array[rdi*8] - ANS 2
The value of the following registers are preserved by convention (all other registers are NOT
guaranteed to retain their prior values after a function call): - ANS RSP, RBP, RBX, R12, R13,
R14, R15
Let's assume rcx = 0x1F5 and rax= 0xC3F.
What's in rax after the following operation:
OR rax, rcx - ANS 0xDFF
Let's assume rcx = 1F5 and rax= C3F (Hexadecimal representation). What is the value in rcx after
the following instruction:
OR rcx, rax - ANS DFF
3 @COPYRIGHT 2025/2026 ALLRIGHTS RESERVED