




























































































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 directory in the Linux kernel source tree contains architecture‑specific code for x86? A) arch/arm B) arch/x C) drivers/net D) include/linux Answer: B Explanation: The arch/x86 directory holds all architecture‑specific files for the x86 family, such as boot code, CPU initialization, and low‑level hardware handling. Question 2. What does the make menuconfig command provide? A) Automatic kernel compilation without user input B) A text‑based interface to select kernel configuration options C) A graphical UI for editing source files D) A tool to patch the kernel source Answer: B Explanation: make menuconfig launches a curses‑based menu that lets the user enable or disable kernel features before building. Question 3. During kernel build, which target creates loadable kernel modules without rebuilding the core kernel? A) make all B) make modules_install C) make modules
D) make bzImage Answer: C Explanation: make modules compiles only the loadable modules, leaving the core kernel image untouched. Question 4. Which file is typically used by the bootloader to load the initial RAM disk? A) /boot/vmlinuz B) /boot/initrd.img C) /etc/fstab D) /proc/mounts Answer: B Explanation: initrd.img (or initramfs) provides a temporary root filesystem used by the bootloader before the real root filesystem is mounted. Question 5. In the kernel version string “5.15.0‑rc7”, what does “rc7” indicate? A) Stable release B) Release candidate 7 C) Mainline branch number D) Long‑term support version Answer: B Explanation: “rc” stands for release candidate; “rc7” is the seventh candidate before the final 5.15.0 release.
C) clone() D) vfork() Answer: B Explanation: fork() creates a new process with a duplicate of the parent’s memory space (copy‑on‑write). Question 9. What is the first function executed after the kernel is loaded into memory on most architectures? A) init() B) start_kernel() C) main() D) kernel_main() Answer: B Explanation: start_kernel() performs early initialization, sets up memory management, and launches the init process. Question 10. Which component creates the initial kernel threads such as ksoftirqd and kswapd? A) init process B) start_kernel() C) initcall subsystem D) module loader Answer: B
Explanation: After basic setup, start_kernel() spawns essential kernel threads for background tasks. Question 11. In the Linux MMU, what is a “page frame” referring to? A) A virtual memory page in a process address space B) A fixed‑size block of physical memory managed by the kernel C) A software data structure for file caching D) An entry in the swap area Answer: B Explanation: A page frame is a physical memory block of size equal to a page (commonly 4 KB) used by the MM subsystem. Question 12. Which allocator is best suited for allocating many objects of the same size with low fragmentation? A) kmalloc() B) vmalloc() C) SLAB/SLUB allocator D) Buddy system Answer: C Explanation: SLAB (or its newer SLUB) caches objects of a particular size, reducing fragmentation and allocation overhead. Question 13. What does kmalloc() allocate? A) Contiguous physical memory only
Answer: B Explanation: The Out‑of‑Memory (OOM) Killer selects victim processes based on heuristics to reclaim memory. Question 16. Which system call creates a new memory mapping in a process’s address space? A) mmap() B) mprotect() C) brk() D) munmap() Answer: A Explanation: mmap() maps files or anonymous memory into a process’s virtual address space. Question 17. In the task_struct, which field stores the process’s parent? A) real_parent B) parent C) ppid D) tgid Answer: B Explanation: The parent pointer points to the immediate parent task; real_parent is used for reparenting after exit. Question 18. Which clone flag creates a new thread that shares the address space with its parent?
Answer: A Explanation: CLONE_VM makes the child share the same memory space, forming a thread rather than a separate process. Question 19. What does the SCHED_FIFO scheduling policy guarantee? A) Time‑sharing fairness B) Fixed‑priority preemptive real‑time behavior C) Round‑robin scheduling with quantum D) No preemption at all Answer: B Explanation: SCHED_FIFO is a real‑time policy where higher‑priority tasks run until they block or voluntarily yield. Question 20. Which kernel data structure implements the Completely Fair Scheduler’s red‑black tree? A) runqueue list B) rq->cfs_rq->rb_root C) task_struct->se D) sched_entity
A) mutex_lock() B) down_interruptible() C) atomic_inc() D) wait_event() Answer: C Explanation: Atomic operations like atomic_inc() are lock‑free and safe in interrupt context; mutexes and wait queues may sleep. Question 24. What does an RCU read‑side critical section guarantee? A) No other CPU can modify the data while the section runs B) The reader can proceed without acquiring locks and sees a consistent view C) Writes are blocked until all readers finish D) The section runs at elevated interrupt priority Answer: B Explanation: RCU allows lock‑free reads; writers synchronize using synchronize_rcu(), while readers simply use rcu_read_lock()/rcu_read_unlock(). Question 25. Which kernel mechanism is most appropriate for deferring work that may sleep? A) Softirq B) Tasklet C) Workqueue D) Bottom‑half handler
Answer: C Explanation: Workqueues execute in process context, allowing sleeping operations, unlike softirqs and tasklets which run in interrupt context. Question 26. In the interrupt handling flow, where is the “top half” executed? A) In user space after the interrupt returns B) Immediately upon entry to the interrupt vector, with interrupts disabled C) In a kernel thread scheduled later D) In the softirq daemon Answer: B Explanation: The top half runs directly in the interrupt handler, must be quick, and executes with local interrupts disabled. Question 27. Which data structure holds pending softirqs for each CPU? A) per‑cpu softirq_vec B) tasklet list C) workqueue pool D) irq_desc Answer: A Explanation: Each CPU has a softirq_vec (or softirq_pending) bitmap indicating which softirqs need processing. Question 28. What is the primary advantage of using a tasklet over a softirq? A) Tasklets can be preempted by other tasklets
Explanation: jiffies is a global counter incremented at each timer tick (frequency defined by HZ), representing elapsed ticks since system start. Question 31. Which function registers a loadable kernel module’s initialization routine? A) module_init() B) init_module() C) __initcall() D) register_module() Answer: A Explanation: module_init() macro specifies the function to be called when the module is loaded. Question 32. How can a kernel module declare a parameter that can be set at load time? A) MODULE_PARAM(name, type, perm) B) module_param(name, type, perm) C) param_set(name, value) D) sysfs_create_param() Answer: B Explanation: module_param() macro defines a tunable parameter; MODULE_PARAM does not exist. Question 33. Which kernel log level corresponds to an error message that should always be printed? A) KERN_DEBUG
Answer: D Explanation: KERN_ERR is used for error conditions; it is printed regardless of the console loglevel unless suppressed. Question 34. Where does the dmesg command read its output from? A) /var/log/kern.log B) /proc/kmsg (kernel ring buffer) C) /sys/kernel/debug D) /dev/kmsg Answer: B Explanation: dmesg reads the kernel’s circular log buffer (/proc/kmsg) to display recent messages. Question 35. Which file system provides a view of kernel objects such as processes and modules? A) ext B) procfs C) tmpfs D) sysfs Answer: B
A) kmalloc() B) vmalloc() C) __get_free_pages() D) alloc_pages() Answer: B Explanation: vmalloc() creates virtually contiguous memory that can span multiple non‑contiguous physical pages. Question 39. In a character device driver, which function is responsible for mapping user‑space memory into the device’s address space? A) open() B) read() C) mmap() D) ioctl() Answer: C Explanation: The mmap file operation allows user processes to map device memory directly into their address space. Question 40. What does the cdev_add() function do? A) Registers a character device number range with the kernel B) Adds a character device to the sysfs hierarchy C) Associates a struct cdev with a major/minor number and makes it usable D) Creates a device node in /dev
Answer: C Explanation: cdev_add() links a struct cdev (which holds file operations) to a device number, enabling the driver to be accessed. Question 41. Which macro is used to define the file operations structure for a character driver? A) FILE_OPS() B) struct file_operations C) DECLARE_FOPS() D) FOPS_DECLARE() Answer: B Explanation: Drivers declare a struct file_operations variable containing pointers to open, read, write, etc. Question 42. How does a driver safely copy data from user space to kernel space? A) memcpy_from_user() B) copy_from_user() C) get_user() D) strncpy_user() Answer: B Explanation: copy_from_user() checks the user buffer’s accessibility and performs the copy, handling faults safely.
D) dentry->d_op->open Answer: B Explanation: The VFS invokes the open method from the file operations structure associated with the inode. Question 46. What does the sk_buff structure represent in the networking stack? A) A socket descriptor B) A network packet buffer C) A routing table entry D) A network device driver object Answer: B Explanation: sk_buff (socket buffer) holds packet data, metadata, and pointers used throughout the network stack. Question 47. Which netlink family is commonly used for communication between user space and kernel for routing configuration? A) NETLINK_ROUTE B) NETLINK_FIREWALL C) NETLINK_GENERIC D) NETLINK_USERSOCK Answer: A Explanation: NETLINK_ROUTE is used by tools like ip to configure routes, addresses, and interfaces.
Question 48. Which Linux Security Module (LSM) implements mandatory access control using policies written in a high‑level language? A) AppArmor B) SELinux C) TOMOYO D) Smack Answer: B Explanation: SELinux uses a policy language (TE) to define fine‑grained mandatory access control rules. Question 49. What does Address Space Layout Randomization (ASLR) protect against? A) Buffer overflows that rely on fixed addresses B) Unauthorized DMA accesses C) Kernel module loading conflicts D) CPU cache timing attacks Answer: A Explanation: ASLR randomizes the locations of code, stack, and libraries, making it harder for exploits to predict target addresses. Question 50. Which compiler flag enforces stack canary protection in kernel code? A) - fstack-protector-strong B) - fno-omit-frame-pointer C) - fno-pic