Unit 5 - Practice Quiz

INT249

1 Which command is used to change the access timestamp of a file, or create an empty file if it does not exist?

A. cat
B. touch
C. vi
D. mkdir

2 In the vim editor, which mode allows you to type text into the file?

A. Command Mode
B. Visual Mode
C. Insert Mode
D. Ex Mode

3 Which flag is required with the mkdir command to create a directory structure where parent directories do not yet exist (e.g., mkdir /home/user/new/dir)?

A. -p
B. -m
C. -r
D. -f

4 Which command allows you to search for files in a directory hierarchy based on criteria such as name, size, or modification time?

A. locate
B. grep
C. find
D. search

5 When using cp to copy a directory and all its contents, which option is necessary?

A. -f
B. -i
C. -r or -R
D. -v

6 What is the primary difference between a soft link (symbolic link) and a hard link?

A. Hard links can point to directories; soft links cannot.
B. Soft links share the same inode number as the original file; hard links do not.
C. Hard links point to the inode of the file; soft links point to the file path/name.
D. Soft links remain valid even if the original file is deleted.

7 Which command is used to remove a directory that is not empty?

A. rmdir
B. rm -r
C. del
D. erase

8 Which command displays the first 10 lines of a text file by default?

A. tail
B. cat
C. head
D. less

9 You need to monitor a log file in real-time as new lines are written to it. Which command should you use?

A. head -n 10
B. tail -f
C. cat
D. less

10 Which command is used to search for specific text patterns (regular expressions) within a file?

A. find
B. locate
C. grep
D. sed

11 What does the symbol > do in a Linux shell command (e.g., ls > file.txt)?

A. It pipes the output to another command.
B. It redirects standard output to a file, overwriting the file if it exists.
C. It appends standard output to the end of a file.
D. It redirects standard error to a file.

12 Which utility is primarily used for updating the database used by the locate command?

A. update-grub
B. updatedb
C. db_update
D. makewhatis

13 Which grep flag is used to perform a case-insensitive search?

A. -v
B. -i
C. -r
D. -n

14 Which command is used to count the number of lines, words, and characters in a file?

A. count
B. wc
C. nl
D. sum

15 To extract specifically column 3 from a CSV file where fields are separated by a comma, which command is appropriate?

A. cut -d, -f3 file.csv
B. sort -k3 file.csv
C. grep -c3 file.csv
D. paste -s3 file.csv

16 Which command is equivalent to cat but displays file contents in reverse order (last line first)?

A. rev
B. tac
C. backcat
D. reverse

17 Which kernel component acts as an interface between the hardware and the processes?

A. The Shell
B. The Bootloader
C. The Kernel Core
D. The Init System

18 Which command prints the kernel release version (e.g., 5.14.0-70.el9.x86_64)?

A. uname -r
B. uname -n
C. lsmod
D. cat /etc/os-release

19 The /proc directory is best described as:

A. A storage location for system binaries.
B. A pseudo-filesystem containing runtime system information and kernel statistics.
C. A directory for storing persistent user configuration files.
D. The mounting point for external process drives.

20 Which command lists all currently loaded kernel modules?

A. modprobe -l
B. lsmod
C. insmod
D. depmod

21 Which command is used to load a kernel module along with its dependencies?

A. insmod
B. modprobe
C. loadmod
D. lsmod

22 Which file path typically contains the configuration for blacklisting kernel modules?

A. /etc/sysconfig/kernel
B. /boot/grub2/grub.cfg
C. /etc/modprobe.d/
D. /proc/sys/kernel/

23 Which command is used to remove a module from the Linux kernel?

A. delmod
B. rmmod
C. modprobe -i
D. lsmod -d

24 What information does the modinfo command display?

A. The amount of RAM the module is using.
B. Information about a Linux kernel module, such as author, description, and parameters.
C. The boot logs associated with the module.
D. The list of files created by the module.

25 Which directory contains the parameters for the Linux kernel that can be modified at runtime using sysctl?

A. /proc/sys
B. /sys/class
C. /etc/kernel
D. /boot

26 What is the very first step in the Linux boot process after the power button is pressed?

A. Kernel Initialization
B. BIOS/UEFI POST (Power On Self Test)
C. GRUB2 Loading
D. systemd execution

27 In the Linux boot process, what is the role of the initramfs?

A. It is the main file system where user data is stored.
B. It is a temporary root filesystem loaded into memory to assist the kernel in mounting the real root filesystem.
C. It configures the network interfaces.
D. It stores the GRUB configuration.

28 Which process ID (PID) is assigned to the first process started by the kernel (e.g., systemd or init)?

A.
B. 1
C. 100
D. 1000

29 What is GRUB2?

A. A text editor.
B. A kernel compiler.
C. A bootloader.
D. A file compression tool.

30 Which configuration file is edited to make persistent changes to GRUB2 settings (like timeout or kernel parameters)?

A. /boot/grub2/grub.cfg
B. /etc/default/grub
C. /etc/sysconfig/boot
D. /proc/grub

31 After modifying /etc/default/grub, which command must be run to apply the changes on a BIOS-based system?

A. grub2-install /dev/sda
B. grub2-mkconfig -o /boot/grub2/grub.cfg
C. systemctl restart grub
D. reboot

32 In the /etc/default/grub file, which parameter controls the time (in seconds) the menu is displayed before the default entry is booted?

A. GRUB_TIMEOUT
B. GRUB_DISTRIBUTOR
C. GRUB_CMDLINE_LINUX
D. GRUB_DEFAULT

33 Which command displays the message buffer of the kernel (useful for debugging boot issues or hardware errors)?

A. cat /var/log/messages
B. dmesg
C. journalctl
D. klog

34 During the boot process, which directory is typically mounted as the root partition?

A. /boot
B. /
C. /root
D. /home

35 When configuring GRUB2, what does the variable GRUB_CMDLINE_LINUX define?

A. The default kernel version to boot.
B. The background image of the boot menu.
C. Kernel parameters passed to the Linux kernel at boot time.
D. The resolution of the terminal.

36 Which pipe command allows you to view the output of a long file one page at a time (e.g., ls -l /etc | ...)?

A. grep
B. tail
C. more or less
D. tee

37 What is the purpose of the depmod command?

A. To remove modules.
B. To generate modules.dep and map files for module dependencies.
C. To install new kernel headers.
D. To compile source code into a module.

38 Which command is used to install GRUB2 to the Master Boot Record (MBR) of a specific drive (e.g., /dev/sda)?

A. grub2-mkconfig
B. grub2-install /dev/sda
C. install-grub /dev/sda
D. dd if=grub of=/dev/sda

39 In vim, which command is used to save changes and exit the editor?

A. :q!
B. :w
C. :wq or :x
D. :exit

40 What is the function of the sed command in the context sed 's/foo/bar/g' file.txt?

A. It sorts the file by 'foo' and 'bar'.
B. It searches for 'foo' and deletes the line.
C. It substitutes 'foo' with 'bar' globally in the output.
D. It sends the file to the 'bar' directory.

41 Which directory usually contains the kernel image files (beginning with vmlinuz)?

A. /proc
B. /kernel
C. /boot
D. /etc

42 Which command displays the full path of a shell command/executable?

A. where
B. which
C. path
D. findcmd

43 To perform a temporary edit of the GRUB menu entry during boot (e.g., to reset a root password), which key is pressed at the GRUB menu?

A. c
B. e
C. Esc
D. Enter

44 When using sort, which option is used to sort numbers numerically rather than alphabetically (e.g., so 10 comes after 2)?

A. -n
B. -r
C. -u
D. -k

45 Which shell feature allows the output of one command to be used as the input for another command?

A. Redirection (>)
B. Piping (|)
C. Expansion ($)
D. Backgrounding (&)

46 Which wildcard character represents 'zero or more characters' in a filename expansion?

A. ?
B. *
C. #
D. %

47 What is the purpose of the tee command?

A. To filter text.
B. To read from standard input and write to both standard output and files.
C. To measure the time a command takes.
D. To test network connectivity.

48 If you want to append the text 'Hello' to an existing file notes.txt without overwriting it, which command should you use?

A. echo 'Hello' > notes.txt
B. echo 'Hello' >> notes.txt
C. cat 'Hello' | notes.txt
D. paste 'Hello' notes.txt

49 Which file in /proc contains information about the CPU(s)?

A. /proc/meminfo
B. /proc/cpuinfo
C. /proc/processor
D. /proc/interrupts

50 What happens if you run cp file1 file2 and file2 already exists?

A. The command fails with an error.
B. file2 is overwritten with the contents of file1 (unless configured otherwise).
C. file1 is appended to file2.
D. A backup file2.bak is automatically created.