














































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This advanced exam tests device driver development in embedded Linux. Tasks include writing character and block drivers, configuring device trees, handling hardware interrupts, interacting with kernel subsystems, debugging drivers, and ensuring safety/stability. It emphasizes memory management, concurrency control, I/O mechanisms, and kernel API usage.
Typology: Exams
1 / 86
This page cannot be seen from the preview
Don't miss anything!















































































Question 1. Which kernel architecture combines a single large kernel image with many loadable modules? A) Microkernel B) Monolithic kernel with loadable modules C) Hybrid kernel D) Exokernel Answer: B Explanation: A monolithic kernel can be built with many optional loadable modules, keeping the core large but extensible. Question 2. In Linux, which space is used for executing user applications? A) Kernel‑space B) Hypervisor‑space C) User‑space D) Firmware‑space Answer: C Explanation: User‑space is the memory area where normal applications run, isolated from kernel‑space. Question 3. What structure represents a process in the Linux kernel? A) task_struct B) process_control_block C) thread_info D) sched_entity Answer: A Explanation: The task_struct contains all information about a process/thread.
Question 4. Which kernel function is used to allocate memory that can be freed with kfree()? A) vmalloc() B) kmalloc() C) get_free_pages() D) __get_free_pages() Answer: B Explanation: kmalloc() allocates physically contiguous memory suitable for kfree(). Question 5. What does the kernel term “jiffies” represent? A) Number of CPU cycles since boot B) Counter incremented by the timer interrupt C) Number of context switches D) Size of a memory page Answer: B Explanation: Jiffies is a global counter increased at each timer tick, used for timing. Question 6. Which system call creates a new process? A) execve() B) fork() C) clone() D) wait() Answer: B Explanation: fork() duplicates the calling process creating a child.
Question 10. Which tool builds a complete root filesystem for an embedded target? A) Linaro B) Buildroot C) gcc D) strace Answer: B Explanation: Buildroot automates building cross‑compiled toolchains, kernel, and rootfs. Question 11. Which QEMU option emulates an ARM VersatilePB board? A) - M virt B) - M versatilepb C) - M x86_ D) - M raspi Answer: B Explanation: -M versatilepb selects the ARM VersatilePB platform. Question 12. What protocol is commonly used to load a kernel image over Ethernet? A) NFS B) DHCP C) TFTP D) HTTP Answer: C Explanation: TFTP is a simple file‑transfer protocol used by many bootloaders. Question 13. In the Linux boot sequence, which component runs first after the firmware?
A) initrd B) U‑Boot C) Kernel D) Systemd Answer: B Explanation: The bootloader (e.g., U‑Boot) loads and starts the kernel after firmware. Question 14. Which file is typically edited to configure kernel options before compilation? A) Makefile B) .config C) Kconfig D) linuxrc Answer: B Explanation: .config holds the selected kernel configuration options. Question 15. What does the initramfs image contain? A) Full root filesystem B) Minimal user‑space needed to mount the real root C) Kernel modules only D) Bootloader configuration Answer: B Explanation: initramfs provides an early userspace to prepare the real root FS. Question 16. Which command checks a source file for Linux kernel coding style violations? A) checkpatch.pl
B) Automatic resource cleanup on driver removal C) Register character devices D) Provide DMA buffers Answer: B Explanation: devres (device resource management) tracks allocations and frees them when the device is detached. Question 20. Which macro registers a driver that can be auto‑loaded when a matching device appears? A) module_init() B) module_driver() C) MODULE_DEVICE_TABLE() D) device_register() Answer: B Explanation: module_driver() combines init/exit handling with driver registration for hot‑plug. Question 21. Which command loads a kernel module into the running kernel? A) insmod B) modprobe C) rmmod D) depmod Answer: A Explanation: insmod inserts a module file; modprobe also resolves dependencies. Question 22. How does a kernel module indicate that it can be used in a GPL‑compatible project?
Answer: A Explanation: The MODULE_LICENSE macro declares the license; “GPL” enables GPL‑only symbols. Question 23. Which function registers a character device’s file operations? A) register_chrdev_region() B) cdev_add() C) alloc_chrdev_region() D) misc_register() Answer: B Explanation: After allocating a cdev structure, cdev_add() links it with its file_operations. Question 24. What is the purpose of the major number in a device node? A) Identifies the driver class B) Distinguishes between multiple instances of the same driver C) Selects the driver handling the device D) Provides the device’s I/O address Answer: C Explanation: The major number maps a device node to a specific driver. Question 25. Which udev rule attribute matches devices by their vendor ID?
B) misc_register() C) DECLARE_MISC_DEVICE() D) REGISTER_MISC() Answer: B Explanation: misc_register() registers a driver under the “misc” major number. Question 29. What is the primary difference between virtual memory on systems with and without an MMU? A) Page size B) Presence of address translation C) Use of swap space D) Number of processes supported Answer: B Explanation: An MMU provides hardware address translation; without it, virtual memory is limited or absent. Question 30. Which memory zone contains high‑mem pages that are not permanently mapped in the kernel address space? A) DMA B) Normal C) HighMem D) Movable Answer: C Explanation: The HighMem zone holds pages that must be temporarily mapped for access.
Question 31. Which function allocates a contiguous block of pages that can be freed with free_pages()? A) kmalloc() B) __get_free_pages() C) vmalloc() D) alloc_pages() Answer: B Explanation: __get_free_pages() (or get_free_pages()) allocates physically contiguous pages. Question 32. What allocation strategy does the Linux kernel use for small objects to reduce fragmentation? A) Buddy system only B) Slab allocator C) First‑fit allocator D) Bitmap allocator Answer: B Explanation: The slab allocator builds caches of objects of the same size. Question 33. Which function copies data from kernel space to user space safely? A) memcpy_to_user() B) copy_to_user() C) put_user() D) get_user() Answer: B Explanation: copy_to_user() checks the destination address and copies data safely.
Question 37. Which function maps a physical I/O region into kernel virtual address space? A) ioremap() B) kmalloc() C) vmalloc() D) request_mem_region() Answer: A Explanation: ioremap() creates a kernel virtual mapping for a physical I/O address. Question 38. Which synchronization primitive can be used in interrupt context? A) mutex B) semaphore C) spinlock D) completion Answer: C Explanation: Spinlocks are safe in interrupt context because they do not sleep. Question 39. What does the atomic_inc() function do? A) Increment a variable with locking B) Increment an atomic_t safely across CPUs C) Increment and return the new value D) Increment a reference count only if non‑zero Answer: B Explanation: atomic_inc() atomically increments an atomic_t without disabling preemption.
Question 40. Which lock type is designed for readers‑writer scenarios with low write contention? A) rwlock_t B) spinlock_t C) mutex D) seqlock_t Answer: D Explanation: seqlock_t allows multiple readers without blocking, while writers acquire exclusive access. Question 41. Which API is used to put a task to sleep until a condition becomes true? A) wait_event() B) schedule() C) msleep() D) down() Answer: A Explanation: wait_event() puts the current task to sleep and wakes it when the condition is met. Question 42. Which function wakes up all tasks waiting on a wait queue? A) wake_up() B) wake_up_interruptible() C) wake_up_all() D) complete() Answer: C Explanation: wake_up_all() wakes every task on the specified wait queue.
Question 46. Which function registers an interrupt handler for a given IRQ number? A) request_irq() B) enable_irq() C) register_irq() D) bind_irq() Answer: A Explanation: request_irq() associates a handler with an interrupt line. Question 47. What is a “top half” of an interrupt handler responsible for? A) Performing lengthy processing B) Scheduling a bottom half or workqueue C) Accessing user space memory D) Disabling the interrupt line permanently Answer: B Explanation: The top half does minimal work and typically wakes a bottom half for deferred processing. Question 48. Which kernel mechanism provides a soft interrupt context that can run on any CPU? A) Tasklet B) Workqueue C) Softirq D) Threaded IRQ Answer: C Explanation: Softirqs are a lightweight, CPU‑agnostic deferred execution mechanism.
Question 49. Which API creates a workqueue item that executes in process context? A) tasklet_schedule() B) schedule_work() C) init_softirq() D) init_irq_work() Answer: B Explanation: schedule_work() enqueues a work_struct to be run by a kernel worker thread. Question 50. How can a driver create a kernel thread? A) kthread_create() B) kernel_thread() C) create_kthread() D) spawn_thread() Answer: A Explanation: kthread_create() creates a thread that runs a specified function in kernel space. Question 51. Which function retrieves the current value of jiffies in nanoseconds? A) jiffies_to_nsecs() B) jiffies_to_usecs() C) nsec_to_jiffies() D) get_jiffies_64() Answer: A Explanation: jiffies_to_nsecs() converts jiffies to nanoseconds.
Question 55. Which structure represents a platform device in the driver model? A) platform_device B) device_node C) pci_dev D) i2c_client Answer: A Explanation: struct platform_device describes devices that are not discoverable via standard buses. Question 56. In a device tree source file, which keyword defines a node’s compatible string? A) compatible = “...” ; B) device_type = “...” ; C) model = “...” ; D) status = “...” ; Answer: A Explanation: The compatible property lists strings that drivers match against. Question 57. Which kernel subsystem creates entries under /sys/class/...? A) sysfs B) procfs C) debugfs D) devtmpfs Answer: A Explanation: sysfs exports kernel objects as files under /sys.
Question 58. What is the purpose of kobject in the Linux driver model? A) Represent a hardware interrupt line B) Provide a generic object for sysfs representation C) Manage kernel threads D) Allocate DMA buffers Answer: B Explanation: kobject is the base for objects that appear in sysfs. Question 59. Which ioctl command direction macro indicates data is copied from user to kernel? A) _IOW B) _IOR C) _IOWR D) _IO Answer: A Explanation: _IOW stands for “write” from user space to kernel. Question 60. Which function initiates a DMA transfer from a device to a memory buffer? A) dma_map_single() B) dma_sync_single_for_cpu() C) dmaengine_submit() D) dmaengine_prep_slave_sg() Answer: C Explanation: dmaengine_submit() queues a DMA transaction on the DMA engine.