Make an answer key with concise explanations for the following.:
1. Which command is used to load a module in Linux?
a) insmod
b) rmmod
c) modprobe
d) lsmod

2. What is the purpose of the make command in kernel module development?
a) To compile the module source code
b) To link the module object files
c) To load the module into the kernel
d) To unload the module from the kernel

3. What is the module initialization function called in a Linux kernel module?
a) init_module
b) cleanup_module
c) main
d) exit

4. How can we pass parameters to a kernel module during its loading?
a) Using command-line arguments
b) Using a configuration file
c) Through environment variables
d) Module parameters are not supported in Linux kernel modules

5. Which data structure in the Linux kernel is used to represent linked lists?
a) list_head
b) struct_node
c) struct_list
d) linked_list

6. Which kernel module code section should be used for functions that handle file operations?
a) .bss
b) .text
c) .data
d) .rodata

7. How can we obtain the current process ID in a kernel module?
a) Using the getpid() function
b) Using the current->pid variable
c) Accessing the process ID from the task_struct structure
d) Kernel modules cannot access process IDs

8. Which system call is used to allocate memory in the Linux kernel?
a) malloc()
b) kmalloc()
c) get_free_pages()
d) alloc_pages()

9. What is the purpose of the register_chrdev() function in Linux kernel modules?
a) To allocate memory for character devices
b) To unregister a character device
c) To register a character device with the kernel
d) To perform character device I/O operations

10. Which utility is used to debug kernel modules?
a) gdb
b) strace
c) valgrind
d) printk

11. Which file should be modified to define the module license and author information?
a) module_info.h
b) license_info.h
c) author_info.h
d) Makefile

12. Which header file should be included in a Linux kernel module to use the GPIO functionality?
a) linux/gpio.h
b) linux/irq.h
c) linux/kernel.h
d) linux/module.h

13. How can we pass data between the kernel and user space in a Linux kernel module?
a) Using global variables
b) Through shared memory
c) By writing to files in the /proc directory
d) Kernel modules cannot communicate with user space

14. Which function is used to allocate a device number dynamically in a Linux kernel module?
a) alloc_chrdev_region()
b) register_chrdev_region()
c) request_irq()
d) get_inode_number()

15. How can we unregister a character device in a Linux kernel module?
a) Using the unregister_chrdev() function
b) By removing it from the /dev directory
c) By freeing the allocated device number
d) Unregistering a character device is not required in kernel modules

16. Which kernel module code section should be used for global variables?
a) .bss
b) .text
c) .data
d) .rodata

17. Which function is called when a module is unloaded from the Linux kernel?
a) cleanup_module()
b) init_module()
c) exit()
d) main()

18. What is the purpose of the Linux kernel’s wait_event_interruptible() function?
a) To wait for a specific event
b) To handle keyboard interrupts
c) To wait for the module initialization to complete
d) To synchronize processes in a multi-threaded environment

19. Which file under the /sys directory provides information about currently loaded modules?
a) /sys/kernel/modules
b) /sys/module
c) /sys/devices
d) /sys/kernel

20. Which Linux kernel function is used to wake up a process from sleep?
a) wake_up()
b) signal()
c) kill()
d) return_from_sleep()

21. How can we change the file permissions of a proc file entry in a kernel module?
a) Using the chmod() function
b) By modifying the /proc file attributes directly
c) By calling the set_permissions() system call
d) Proc file permissions cannot be modified in a kernel module

22. Which function is used to write data to a proc file in a Linux kernel module?
a) proc_write_data()
b) fwrite()
c) seq_printf()
d) printk()