




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Question 1. Which x86 register is conventionally used to point to the top of the stack? A) EAX B) EBX C) ESP D) EDI Answer: C Explanation: ESP (or RSP in x86‑64) always contains the address of the current top of the stack; push/pop instructions modify it automatically. Question 2. In a 64‑bit architecture, which of the following registers holds the instruction pointer? A) RIP B) EIP C) RSP D) RBP Answer: A Explanation: RIP (Register Instruction Pointer) is the 64‑bit version of EIP and points to the next instruction to execute. Question 3. What does the ISA acronym stand for? A) Internal System Architecture
B) Instruction Set Architecture C) Integrated Software Application D) Immediate Stack Access Answer: B Explanation: ISA is the set of instructions that a processor can execute, defining how software interacts with hardware. Question 4. Which instruction transfers control to a subroutine while saving the return address on the stack? A) JMP B) CALL C) RET D) PUSH Answer: B Explanation: CALL pushes the address of the next instruction onto the stack and then jumps to the subroutine address. Question 5. Which of the following instructions copies data from one register to another? A) MOV B) POP C) PUSH
Explanation: .kernel is not part of user‑mode process memory; it belongs to the privileged kernel space. Question 8. Which cache level is usually the smallest and fastest? A) L B) L C) L D) L Answer: A Explanation: L1 cache resides closest to the CPU core, offering the lowest latency but smallest capacity. Question 9. What does the MMU primarily handle? A) Process scheduling B) Virtual‑to‑physical address translation C) Disk I/O buffering D) Network packet routing Answer: B Explanation: The Memory Management Unit translates virtual addresses used by programs into physical RAM addresses.
Question 10. Which Linux file permission bit allows a user to execute a file? A) r B) w C) x D) s Answer: C Explanation: The ‘x’ bit grants execute permission; without it a file cannot be run as a program. Question 11. In Windows NTFS, which attribute stores file data? A) $MFT B) $DATA C) $INDEX_ROOT D) $BITMAP Answer: B Explanation: The $DATA attribute contains the actual file contents; NTFS can have multiple $DATA streams per file. Question 12. Which C function allocates memory on the heap and zero‑initializes it? A) malloc()
D) memcpy(dest, src, n); Answer: B Explanation: strcpy copies until a null byte is found without checking the destination size; if src is larger, overflow occurs. Question 15. In a linked list node defined as struct node { int val; struct node *next; };, what does the next field store? A) The value of the next node B) The address of the next node C) The size of the list D) The index of the next node Answer: B Explanation: next is a pointer to another struct node, holding the memory address of the following element. Question 16. Which of the following statements about unions in C is true? A) All members occupy separate memory locations. B) The size of a union is the sum of its members’ sizes. C) Only one member can be used at a time. D) Unions cannot contain pointers. Answer: C
Explanation: All members share the same memory area; only the last stored member is valid. Question 17. Which register typically holds the base address of the current stack frame in x86? A) ESP B) EBP C) ESI D) EDI Answer: B Explanation: EBP (or RBP in x86‑64) is used as a frame pointer to reference local variables and saved registers within a function. Question 18. What does the push ebp instruction accomplish at the start of a function? A) Saves the caller’s base pointer on the stack B) Clears the stack pointer C) Loads the address of the function into EBP D. Allocates space for local variables Answer: A Explanation: push ebp stores the caller’s frame pointer so it can be restored on function exit.
A) Pipes B) Message queues C) Shared memory (POSIX) D) Named pipes (FIFOs) Answer: D Explanation: FIFOs appear as special files in the filesystem and provide a one‑way byte stream between processes. Question 22. What is the primary purpose of the chmod command in Unix‑like systems? A) Change file owner B) Change file permissions C) Change file timestamps D) Change file name Answer: B Explanation: chmod modifies the read/write/execute bits for user, group, and others. Question 23. Which of the following is a characteristic of physical memory? A) It can be larger than the addressable virtual space. B) It is directly accessed by the CPU without translation.
C) It is managed by the OS’s virtual memory subsystem. D) It is shared across all processes without protection. Answer: B Explanation: Physical RAM is the actual hardware memory; the CPU reads/writes it after address translation. Question 24. In a page table entry, what does the “present” flag indicate? A) The page is writable. B) The page is currently in RAM. C) The page is executable. D) The page is shared. Answer: B Explanation: The present bit tells the MMU whether the page resides in physical memory or needs to be fetched from disk. Question 25. Which of the following best describes a “race condition”? A) A deadlock caused by circular waiting. B) A situation where the program’s output depends on the timing of unsynchronized threads. C) An overflow of the stack pointer. D) A buffer overflow caused by user input.
Explanation: __stdcall passes all arguments on the stack; the callee cleans up the stack before returning. Question 28. In the context of buffer overflow exploitation, what does “NOP sled” refer to? A) A sequence of no‑operation instructions used to slide execution into shellcode. B) A list of prohibited system calls. C) A debugging technique for tracing stack frames. D) An array of null bytes used to terminate strings. Answer: A Explanation: A NOP sled increases the chance that the instruction pointer lands somewhere in a series of NOPs before reaching the payload. Question 29. Which of the following is true about the .bss segment? A) It stores read‑only constants. B) It contains uninitialized global/static variables. C) It holds the executable code. D) It is mapped as executable memory. Answer: B Explanation: The .bss segment reserves space for variables that are zero‑initialized at runtime.
Question 30. What does the ret instruction do in x86? A) Pops the top of the stack into EIP, returning to the caller. B) Pushes the current EIP onto the stack. C) Clears the registers. D) Jumps to a fixed address. Answer: A Explanation: ret pops the return address saved by call from the stack and transfers control to it. Question 31. Which of the following best describes a “stack overflow”? A) The stack pointer wraps around to address zero. B) The stack grows beyond its allocated limit, overwriting adjacent memory. C) The stack is locked by another thread. D) The stack contains only NOP instructions. Answer: B Explanation: When a program writes more data to the stack than allocated, it corrupts neighboring memory, often leading to crashes or exploitation. Question 32. In C, what is the result of the expression sizeof(char) on any platform? A) 0
Answer: A Explanation: pushad saves EAX, ECX, EDX, EBX, ESP, EBP, ESI, and EDI onto the stack (in that order). Question 35. Which of the following is a characteristic of a “heap” allocation? A) Fixed size determined at compile time. B) Automatically freed when a function returns. C) Managed via malloc and free. D) Stored in the .text segment. Answer: C Explanation: The heap is a region of memory for dynamic allocation; malloc obtains memory and free releases it. Question 36. In a 32‑bit process, what is the maximum theoretical size of virtual address space? A) 2 GB B) 4 GB C) 8 GB D) 16 GB Answer: B Explanation: 32 bits allow 2³² distinct addresses, which equals 4 GB.
Question 37. Which of the following statements about the execve system call is correct? A) It creates a new process. B) It replaces the current process image with a new program. C) It suspends the calling process. D) It returns the PID of the new program. Answer: B Explanation: execve loads a new executable into the current process, discarding the previous code and data. Question 38. Which Windows permission grants the ability to delete a file? A) Read B) Write C) Execute D) Delete Answer: D Explanation: The Delete permission specifically allows removal of a file; Write alone does not permit deletion. Question 39. In x86‑64, which register is typically used to pass the first integer argument to a function under the System V AMD64 ABI?
C) printf("%s", user_input); D) free Answer: C Explanation: printf with an uncontrolled %s will copy the user‑supplied string onto the stack if the format string isn’t bounded. Question 42. What does the EIP register hold after a CALL instruction executes? A) The address of the called function. B) The address of the next instruction after the call. C) The address of the return location (pushed on the stack). D) Zero. Answer: B Explanation: EIP is updated to point to the first instruction of the callee; the previous EIP (return address) is saved on the stack. Question 43. Which of the following best describes “address space layout randomization” (ASLR)? A) Randomly shuffling the order of instructions in a binary. B) Randomly placing the stack, heap, and libraries at different virtual addresses each execution. C) Encrypting the executable on disk.
D) Using a random key for memory allocation. Answer: B Explanation: ASLR randomizes base addresses of memory regions to make exploitation harder. Question 44. In C, what is the effect of the volatile qualifier on a variable? A) The compiler may cache its value in a register. B) The compiler must reload the variable from memory each time it is accessed. C) The variable becomes read‑only. D) The variable is automatically synchronized across threads. Answer: B Explanation: volatile tells the compiler that the variable can change outside the program’s flow, preventing optimizations that assume stability. Question 45. Which page‑replacement algorithm replaces the page that has not been used for the longest time? A) FIFO B) LRU C) Random D) Clock Answer: B