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?
cat
touch
vi
mkdir
2
In the vim editor, which mode allows you to type text into the file?
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)?
-p
-m
-r
-f
4 Which command allows you to search for files in a directory hierarchy based on criteria such as name, size, or modification time?
locate
grep
find
search
5
When using cp to copy a directory and all its contents, which option is necessary?
-f
-i
-r or -R
-v
6 What is the primary difference between a soft link (symbolic link) and a hard link?
7 Which command is used to remove a directory that is not empty?
rmdir
rm -r
del
erase
8 Which command displays the first 10 lines of a text file by default?
tail
cat
head
less
9 You need to monitor a log file in real-time as new lines are written to it. Which command should you use?
head -n 10
tail -f
cat
less
10 Which command is used to search for specific text patterns (regular expressions) within a file?
find
locate
grep
sed
11
What does the symbol > do in a Linux shell command (e.g., ls > file.txt)?
12
Which utility is primarily used for updating the database used by the locate command?
update-grub
updatedb
db_update
makewhatis
13
Which grep flag is used to perform a case-insensitive search?
-v
-i
-r
-n
14 Which command is used to count the number of lines, words, and characters in a file?
count
wc
nl
sum
15 To extract specifically column 3 from a CSV file where fields are separated by a comma, which command is appropriate?
cut -d, -f3 file.csv
sort -k3 file.csv
grep -c3 file.csv
paste -s3 file.csv
16
Which command is equivalent to cat but displays file contents in reverse order (last line first)?
rev
tac
backcat
reverse
17 Which kernel component acts as an interface between the hardware and the processes?
18
Which command prints the kernel release version (e.g., 5.14.0-70.el9.x86_64)?
uname -r
uname -n
lsmod
cat /etc/os-release
19
The /proc directory is best described as:
20 Which command lists all currently loaded kernel modules?
modprobe -l
lsmod
insmod
depmod
21 Which command is used to load a kernel module along with its dependencies?
insmod
modprobe
loadmod
lsmod
22 Which file path typically contains the configuration for blacklisting kernel modules?
/etc/sysconfig/kernel
/boot/grub2/grub.cfg
/etc/modprobe.d/
/proc/sys/kernel/
23 Which command is used to remove a module from the Linux kernel?
delmod
rmmod
modprobe -i
lsmod -d
24
What information does the modinfo command display?
25
Which directory contains the parameters for the Linux kernel that can be modified at runtime using sysctl?
/proc/sys
/sys/class
/etc/kernel
/boot
26 What is the very first step in the Linux boot process after the power button is pressed?
27 In the Linux boot process, what is the role of the initramfs?
28 Which process ID (PID) is assigned to the first process started by the kernel (e.g., systemd or init)?
29 What is GRUB2?
30 Which configuration file is edited to make persistent changes to GRUB2 settings (like timeout or kernel parameters)?
/boot/grub2/grub.cfg
/etc/default/grub
/etc/sysconfig/boot
/proc/grub
31
After modifying /etc/default/grub, which command must be run to apply the changes on a BIOS-based system?
grub2-install /dev/sda
grub2-mkconfig -o /boot/grub2/grub.cfg
systemctl restart grub
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?
GRUB_TIMEOUT
GRUB_DISTRIBUTOR
GRUB_CMDLINE_LINUX
GRUB_DEFAULT
33 Which command displays the message buffer of the kernel (useful for debugging boot issues or hardware errors)?
cat /var/log/messages
dmesg
journalctl
klog
34 During the boot process, which directory is typically mounted as the root partition?
/boot
/
/root
/home
35
When configuring GRUB2, what does the variable GRUB_CMDLINE_LINUX define?
36
Which pipe command allows you to view the output of a long file one page at a time (e.g., ls -l /etc | ...)?
grep
tail
more or less
tee
37
What is the purpose of the depmod command?
modules.dep and map files for module dependencies.
38
Which command is used to install GRUB2 to the Master Boot Record (MBR) of a specific drive (e.g., /dev/sda)?
grub2-mkconfig
grub2-install /dev/sda
install-grub /dev/sda
dd if=grub of=/dev/sda
39
In vim, which command is used to save changes and exit the editor?
:q!
:w
:wq or :x
:exit
40
What is the function of the sed command in the context sed 's/foo/bar/g' file.txt?
41
Which directory usually contains the kernel image files (beginning with vmlinuz)?
/proc
/kernel
/boot
/etc
42 Which command displays the full path of a shell command/executable?
where
which
path
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?
c
e
Esc
Enter
44
When using sort, which option is used to sort numbers numerically rather than alphabetically (e.g., so 10 comes after 2)?
-n
-r
-u
-k
45 Which shell feature allows the output of one command to be used as the input for another command?
>)
|)
$)
&)
46 Which wildcard character represents 'zero or more characters' in a filename expansion?
?
*
#
%
47
What is the purpose of the tee command?
48
If you want to append the text 'Hello' to an existing file notes.txt without overwriting it, which command should you use?
echo 'Hello' > notes.txt
echo 'Hello' >> notes.txt
cat 'Hello' | notes.txt
paste 'Hello' notes.txt
49
Which file in /proc contains information about the CPU(s)?
/proc/meminfo
/proc/cpuinfo
/proc/processor
/proc/interrupts
50
What happens if you run cp file1 file2 and file2 already exists?
file2 is overwritten with the contents of file1 (unless configured otherwise).
file1 is appended to file2.
file2.bak is automatically created.