








































































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 register holds the address of the next instruction to be executed in 32-bit x86? A) EAX B) EBX C) EIP D) ESP Answer: C Explanation: EIP (Instruction Pointer) always points to the next instruction. Question 2. In a 64-bit system, which register is the primary stack pointer? A) RAX B) RBX C) RSP D) RBP Answer: C Explanation: RSP (Stack Pointer) tracks the top of the stack in x86-64. Question 3. What is the main advantage of a 64-bit architecture over a 32-bit one? A) Faster clock speeds B) Larger addressable memory space C) Simpler instruction set D) Reduced power consumption Answer: B Explanation: 64-bit CPUs can address far more memory than 32-bit CPUs.
Question 4. Which of the following x86 instructions copies data from one register to another? A) PUSH B) POP C) MOV D) CALL Answer: C Explanation: MOV transfers data between registers, memory, or immediate values. Question 5. The instruction “CALL” in x86 does which two actions? A) Pushes the return address onto the stack and jumps to the target B) Pops a value from the stack and stores it in EAX C) Increments the stack pointer and jumps to the target D) Clears the direction flag and jumps to the target Answer: A Explanation: CALL saves the return address on the stack before transferring control. Question 6. Which register is conventionally used to pass the first integer argument in the Microsoft __stdcall calling convention on x86-64? A) RCX B) RDX C) R D) R Answer: A Explanation: RCX holds the first integer argument in the Windows x64 calling convention.
A) A collection of threads sharing the same address space B) A single thread with its own registers only C) An executable file on disk D) A kernel module loaded at boot time Answer: A Explanation: A process contains one or more threads and owns a virtual address space. Question 11. The unique identifier assigned by the OS to each running process is called: A) TID B) UID C) PID D) GID Answer: C Explanation: PID (Process ID) uniquely identifies a process. Question 12. Which IPC mechanism uses a named object that can be accessed by unrelated processes? A) Signals B) Pipes C) Shared memory D) Sockets Answer: C Explanation: Shared memory creates a named region that multiple processes can map. Question 13. Which Linux file system stores permissions as three sets of rwx bits?
C) ext D) exFAT Answer: C Explanation: ext4 (and other Unix filesystems) use owner, group, and others rwx bits. Question 14. In Windows NTFS, which permission allows a user to delete a file? A) Read B) Write C) Execute D) Delete Answer: D Explanation: The Delete permission explicitly grants file-deletion rights. Question 15. In C, the expression “ptr = 5;” performs which operation? A) Increments the pointer by 5 B) Stores the value 5 at the address pointed to by ptr C) Returns the address of ptr plus 5 D) Compares the contents of ptr with 5 Answer: B Explanation: The dereference operator () writes to the memory location. Question 16. Which C data type typically occupies 8 bytes on a 64-bit Linux system? A) char B) int
Answer: A Explanation: The prologue saves the old base pointer and sets up a new stack frame. Question 20. Which calling convention cleans the stack after a function returns? A) cdecl B) stdcall C) fastcall D) thiscall Answer: B Explanation: stdcall requires the callee to pop the arguments. Question 21. An array of 10 integers in C occupies how many bytes on a 32-bit system? A) 10 B) 20 C) 40 D) 80 Answer: C Explanation: Each int is 4 bytes; 10 × 4 = 40 bytes. Question 22. Which data structure allows O(1) average-time insertion at the front? A) Array B) Linked list C) Binary tree D) Hash table Answer: B
Explanation: Adding a node at the head of a singly linked list is constant time. Question 23. In a C struct, members are laid out in memory: A) Alphabetically by name B) In the order declared, with possible padding C) Randomly by the compiler D) Sorted by size descending Answer: B Explanation: The compiler respects declaration order but may insert padding for alignment. Question 24. The .text segment of a process contains: A) Global variables B) Heap allocations C) Executable code D) Stack frames Answer: C Explanation: .text holds read-only machine code. Question 25. Which segment is typically marked as “rw-” (read/write, non-executable)? A) .text B) .data C) .bss D) Both B and C Answer: D Explanation: Initialized (.data) and uninitialized (.bss) data are writable but not executable.
Question 29. In a typical function call, where are the first few integer arguments placed on x86-64 System V ABI? A) On the stack only B) In registers RDI, RSI, RDX, RCX, R8, R C) In EAX, EBX, ECX, EDX D) In memory-mapped IO Answer: B Explanation: The first six integer arguments are passed in those registers. Question 30. Which of the following is a common cause of a stack-based buffer overflow? A) Using malloc without free B) Writing past the end of a local array C) Dereferencing a null pointer D) Using a dangling pointer after free Answer: B Explanation: Overrunning a local buffer overwrites adjacent stack data. Question 31. The “NOP” (0x90) instruction is often used in exploit development to: A) Trigger a segmentation fault B] Align the stack pointer C) Pad shellcode for reliable execution D) Disable interrupts Answer: C Explanation: NOP sleds increase the chance of landing in shellcode. Question 32. Which of the following is NOT a valid x86 addressing mode?
Answer: D Explanation: EIP-relative addressing is allowed, but adding a register directly to EIP is not a standard mode. Question 33. The instruction “jmp *%eax” performs: A) A direct jump to the address stored in EAX B) An indirect jump using the value at memory address EAX C) A conditional jump if EAX is zero D) A call to the function pointed by EAX Answer: A Explanation: The asterisk indicates an indirect jump to the address in the register. Question 34. Which of the following best describes “ASLR”? A) A technique to encrypt executable code B) Randomizing memory addresses to hinder exploitation C) A method for compressing binaries D) A debugging protocol for stack traces Answer: B Explanation: Address Space Layout Randomization randomizes base addresses. Question 35. In Linux, the “/proc/self/maps” file shows: A) Open network sockets B) Current process’s memory layout
Answer: A Explanation: The syntax places * inside parentheses before the function name. Question 39. The “malloc” function returns: A) The size of the allocated block B) A pointer to the allocated memory or NULL on failure C) The address of the free list head D) The number of bytes currently allocated in the process Answer: B Explanation: malloc returns a void* to the allocated region. Question 40. In C, the expression “sizeof(ptr)” returns: A) The size of the memory block pointed to B) The size of the pointer variable itself C) The length of the string pointed to D) The number of elements in an array Answer: B Explanation: sizeof applied to a pointer yields the pointer’s own size (e.g., 8 bytes on x64). Question 41. Which of the following is true about the “strncpy” function? A) It always null-terminates the destination buffer B) It copies exactly n bytes, padding with zeros if source is shorter C) It is completely safe against buffer overflows D) It returns the length of the copied string Answer: B
Explanation: strncpy copies up to n bytes and pads with '\0' if needed, but may not null-terminate if source is longer. Question 42. The “ret” instruction in x86 does which of the following? A) Pops the top of the stack into EIP and optionally adjusts the stack pointer B) Pushes the current EIP onto the stack C) Stores the value of EAX into memory at ESP D) Calls an interrupt handler Answer: A Explanation: RET pops the return address and jumps to it; “ret n” also adds n to ESP. Question 43. Which Linux system call is used to create a new process? A) fork() B) execve() C) clone() D) spawn() Answer: A Explanation: fork duplicates the calling process, creating a child. Question 44. In Windows, the API function “CreateThread” returns a handle that represents: A) The process ID of the new thread B) A pointer to the thread’s stack C) A kernel object used to control the thread D) The memory address of the thread’s entry point Answer: C Explanation: The handle is a kernel object that can be waited on or closed.
Question 48. Which Windows file system feature allows per-file compression? A) Sparse files B) NTFS file compression attribute C) FAT32 clusters D) ReFS deduplication Answer: B Explanation: NTFS supports a compression flag on individual files. Question 49. The C expression “(char )&var + 1” performs: A) Pointer arithmetic adding one byte to the address of var B) Adding one element of type char to the pointer C) Casting var to char then adding one integer D) None of the above Answer: A Explanation: After casting to char, adding 1 moves the address by one byte. Question 50. Which of the following statements about “union” in C is correct? A) All members share the same memory location B) Each member has its own distinct memory region C) Unions cannot contain pointers D) The size of a union is always equal to the size of its first member Answer: A Explanation: A union overlays all members, using the size of the largest member. Question 51. In x86-64, the instruction “lea rax, [rbx+rcx2]” computes: A) rax = rbx + rcx * 2 without affecting flags B) rax = memory at address rbx+rcx
C) rax = rbx * rcx + 2 D) rax = rbx – rcx* Answer: A Explanation: LEA loads the effective address, performing arithmetic only. Question 52. Which of the following best describes a “shellcode”? A) A high-level scripting language interpreter B) Machine code designed to be injected and executed in a target process C) A compiler optimization pass D) An operating system kernel module Answer: B Explanation: Shellcode is raw assembly bytes used in exploits. Question 53. The “NOP sled” technique improves exploit reliability by: A) Making the payload smaller B) Allowing the instruction pointer to land anywhere within a range of NOPs and slide into the payload C) Encrypting the payload to avoid detection D) Bypassing DEP (Data Execution Prevention) automatically Answer: B Explanation: A series of NOPs increases the landing zone for the jump. Question 54. Which Windows security feature prevents execution of code in non-executable memory regions? A) UAC B) DEP (Data Execution Prevention) C) ASLR
Explanation: In the child, fork returns 0; in the parent it returns the child’s PID. Question 58. Which of the following is true about “execve”? A) It creates a new process without replacing the current one B) It replaces the current process image with a new program C) It only works on Windows systems D) It duplicates the calling process’s address space Answer: B Explanation: execve loads a new executable over the calling process. Question 59. In the context of exploit development, “ROP” stands for: A) Return-Oriented Programming B) Remote Object Protocol C) Randomized Opcode Padding D) Register Optimization Process Answer: A Explanation: ROP chains together existing code “gadgets” ending in a RET. Question 60. Which register typically holds the return value of a function in the System V AMD64 ABI? A) RAX B) RBX C) RCX D) RDX Answer: A Explanation: RAX is used for integer return values.
Question 61. The instruction “int 0x80” on Linux x86 triggers: A) A software interrupt for system calls B) A hardware I/O port read C) A breakpoint exception D) A context switch to user mode Answer: A Explanation: int 0x80 invokes the Linux system call interface on 32-bit. Question 62. Which of the following is a direct consequence of disabling stack canaries? A) Improved performance B) Increased resistance to buffer overflows C) The program becomes vulnerable to stack-smashing attacks D) Automatic memory leak detection Answer: C Explanation: Stack canaries detect overwritten return addresses; disabling them removes that protection. Question 63. In C, the “volatile” qualifier is used to: A) Prevent the compiler from optimizing accesses to the variable B) Make the variable read-only C) Allocate the variable in the .bss segment D) Ensure the variable is stored on the stack Answer: A Explanation: volatile tells the compiler that the value may change outside normal code flow.