Docsity

Linux Fundamentals Ultimate Exam, Exams of Technology

Toggle sidebar
bg1
Linux Fundamentals Ultimate Exam
**Question 1.** Which directory in the Linux Filesystem Hierarchy Standard (FHS)
contains system-wide configuration files?
A) /bin
B) /etc
C) /var
D) /usr
Answer: B
Explanation: /etc is designated for host-specific system configuration files, such as
network settings and service definitions.
**Question 2.** What is the primary role of the Linux kernel?
A) Provide a graphical user interface
B) Manage hardware resources and system calls
C) Store user data files
D) Compile source code
Answer: B
Explanation: The kernel abstracts hardware, schedules processes, and handles
system calls, acting as the core of the OS.
**Question 3.** In a GRUB2 configuration, which file typically defines the default
boot entry?
A) /boot/grub/grub.cfg
B) /etc/fstab
C) /etc/default/grub
D) /boot/vmlinuz
Answer: C
Explanation: /etc/default/grub contains variables like GRUB_DEFAULT that control
the default menu entry; grub.cfg is generated from it.
**Question 4.** Which of the following package managers is native to Red
Hat-based distributions?
A) apt-get
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e

Partial preview of the text

Download Linux Fundamentals Ultimate Exam and more Exams Technology in PDF only on Docsity!

Question 1. Which directory in the Linux Filesystem Hierarchy Standard (FHS) contains system-wide configuration files? A) /bin B) /etc C) /var D) /usr Answer: B Explanation: /etc is designated for host-specific system configuration files, such as network settings and service definitions. Question 2. What is the primary role of the Linux kernel? A) Provide a graphical user interface B) Manage hardware resources and system calls C) Store user data files D) Compile source code Answer: B Explanation: The kernel abstracts hardware, schedules processes, and handles system calls, acting as the core of the OS. Question 3. In a GRUB2 configuration, which file typically defines the default boot entry? A) /boot/grub/grub.cfg B) /etc/fstab C) /etc/default/grub D) /boot/vmlinuz Answer: C Explanation: /etc/default/grub contains variables like GRUB_DEFAULT that control the default menu entry; grub.cfg is generated from it. Question 4. Which of the following package managers is native to Red Hat-based distributions? A) apt-get

B) pacman C) yum / dnf D) emerge Answer: C Explanation: yum (now dnf) handles RPM packages on RHEL, CentOS, Fedora, and related systems. Question 5. The command lsblk is used to: A) List loaded kernel modules B) Show block device information and their mount points C) Display active network interfaces D) List current users Answer: B Explanation: lsblk prints a tree of block devices (disks, partitions) and where they are mounted. Question 6. Which runlevel (or systemd target) corresponds to multi-user mode without graphical interface? A) runlevel 0 / poweroff.target B) runlevel 3 / multi-user.target C) runlevel 5 / graphical.target D) runlevel 6 / reboot.target Answer: B Explanation: Traditional runlevel 3 and systemd’s multi-user.target provide networking and multiple users but no X server. Question 7. What does the chmod 4755 file command set on a file? A) Setuid bit, rwx for owner, rx for group/others B) Sticky bit only C) SGID bit, rwx for owner, rw for group, r for others D) No special bits, just rwx for all

Question 11. The systemctl enable sshd command does what? A) Starts the sshd service immediately B) Restarts the sshd service C) Configures sshd to start automatically at boot D) Disables sshd permanently Answer: C Explanation: enable creates the necessary symlinks so the service starts on system boot. Question 12. Which of the following is a long-term support (LTS) Linux kernel series? A) 5. B) 5. C) 5. D) 6. Answer: A Explanation: Kernel 5.10 is designated LTS, receiving maintenance for several years, unlike interim releases. Question 13. What does the ln -s /opt/app /usr/local/bin/app command create? A) A hard link named app in /usr/local/bin B) A symbolic link named app in /usr/local/bin pointing to /opt/app C) A copy of /opt/app in /usr/local/bin D) A directory named app in /usr/local/bin Answer: B Explanation: -s creates a soft (symbolic) link; the link file resides in /usr/local/bin. Question 14. Which environment variable defines the directories the shell searches for executable programs? A) HOME

B) USER

C) PATH

D) SHELL

Answer: C Explanation: PATH is a colon-separated list of directories that the shell scans to locate commands. Question 15. The ps aux | grep httpd pipeline is used to: A) List all processes and then filter for those containing “httpd” B) Kill all httpd processes C) Show network sockets used by httpd D) Display disk usage of httpd files Answer: A Explanation: ps aux lists all processes; piping to grep httpd selects lines with “httpd”. Question 16. In the context of Linux licensing, which statement best describes the GPL? A) It is a permissive license allowing proprietary redistribution without source code disclosure. B) It requires that derivative works also be distributed under the GPL (copyleft). C) It only applies to documentation. D) It is a public domain dedication. Answer: B Explanation: The GNU General Public License enforces copyleft, demanding that modified versions remain under the same license. Question 17. Which command is used to display the kernel ring buffer messages, often useful for debugging boot problems? A) dmesg B) journalctl C) syslogd

Explanation: fdisk -l reads partition tables and prints partition information for each detected disk. Question 21. Which command can be used to display the current runlevel (or systemd target) of a Linux system? A) runlevel B) systemctl get-default C) whoami D) uname -r Answer: B Explanation: systemctl get-default shows the default systemd target; runlevel works on SysVinit systems. Question 22. What does the awk '{print $2}' /etc/passwd command output? A) The usernames (first field) B) The user IDs (third field) C) The home directories (sixth field) D) The second colon-separated field, which is the password placeholder (usually “x”) Answer: D Explanation: awk splits each line on whitespace (or default FS = space/tab); $2 refers to the second field, which in /etc/passwd is the password placeholder. Question 23. Which of the following is a valid regular expression to match any line that starts with “error” (case-insensitive) using grep? A) grep -i '^error' file B) grep -i 'error$' file C) grep -i 'error' file D) grep -i 'error.*' file Answer: A Explanation: ^ anchors the match at the start of the line; -i makes it case-insensitive.

Question 24. In systemd, what is the purpose of the WantedBy=multi- user.target directive inside a service unit file? A) It makes the service start only after the graphical target. B) It tells systemd to start the service when multi-user.target is reached. C) It disables the service permanently. D) It defines a dependency on the network service. Answer: B Explanation: WantedBy= creates a symlink in the target’s wants directory, causing the service to be pulled in when that target is activated. Question 25. The command chmod u+s /usr/bin/passwd sets which special permission? A) Sticky bit B) Setgid bit C) Setuid bit D) No special permission, only user execute Answer: C Explanation: The u+s flag sets the setuid bit, causing the program to run with the file owner’s privileges (root for /usr/bin/passwd). Question 26. Which of the following files is used by apt to store the list of available packages from repositories? A) /etc/apt/sources.list.d/* B) /var/lib/apt/lists/* C) /var/log/apt/history.log D) /usr/share/doc/apt/README Answer: B Explanation: After apt update, package metadata are stored under /var/lib/apt/lists/. Question 27. What does the scp user@host:/tmp/file . command do?

D) Store kernel boot parameters Answer: C Explanation: fstab provides a table of filesystems to be mounted automatically at boot or on demand. Question 31. Which command will display the IP address(es) assigned to all network interfaces? A) ifconfig -a B) ip addr show C) netstat -i D) route -n Answer: B Explanation: ip addr show (or ip a) lists each interface with its IP configuration; ifconfig is deprecated but still works on some systems. Question 32. The grep -v '^#' /etc/hosts command: A) Shows only comment lines starting with # B) Excludes comment lines and prints the rest of the file C) Replaces # with nothing D) Counts the number of comment lines Answer: B Explanation: -v inverts the match, so lines not matching the pattern (^#) are printed. Question 33. Which of the following is a characteristic of a “hard link” in Linux? A) Can span different file systems B) Points to a directory only C) Increments the inode link count and shares the same inode as the original file D) Is created with ln -s Answer: C

Explanation: Hard links reference the same inode; they cannot cross filesystem boundaries and are made with ln (without -s). Question 34. What does the mount -o remount,rw / command accomplish? A) Mounts a new filesystem on / B) Remounts the root filesystem as read-write C) Unmounts the root filesystem D) Checks the filesystem for errors Answer: B Explanation: The remount option changes mount options of an already mounted filesystem; rw sets it to read-write. Question 35. Which command will display the last 5 lines of a file named “report.log” and also number each line? A) tail -n 5 -b report.log B) tail -5 -n report.log C) tail -n 5 -v report.log D) tail -n 5 -n report.log | nl Answer: D Explanation: tail -n 5 extracts the last 5 lines; piping to nl numbers them. No single tail option numbers lines. Question 36. In the context of Linux kernel development, what does “mainline” refer to? A) The stable release branch used by most production servers B) The development branch where new features are merged before being released C) A custom kernel built for embedded devices D) The branch that contains only security patches Answer: B Explanation: Mainline is the upstream development tree (managed by Linus Torvalds) where new code lands before being stabilized.

C) 1 GB

D) 10 GB

Answer: B Explanation: Block size (bs) is 1 MiB; count=10 writes 10 blocks → 10 MiB. Question 41. Which of the following best describes the purpose of the sudo command? A) Switch user to root without authentication B) Execute a command with elevated privileges after authenticating the invoking user C) Permanently change a user’s UID to 0 D) Log out all users from the system Answer: B Explanation: sudo prompts for the invoking user's password (if configured) and runs the specified command as another user, usually root. Question 42. In Bash, what does the construct [[ -f "$var" ]] && echo "File exists" do? A) Checks if $var is a regular file and prints a message if true B) Checks if $var is a directory C) Always prints “File exists” D) Creates a new file named $var Answer: A Explanation: -f tests for a regular file; && executes the echo only if the test succeeds. Question 43. Which file contains the mapping of numeric user IDs to usernames on most Linux systems? A) /etc/shadow B) /etc/passwd C) /etc/group D) /etc/login.defs

Answer: B Explanation: /etc/passwd lists each account with fields including UID and username. Question 44. What is the effect of the command systemctl isolate rescue.target? A) Reboots the system into rescue mode B) Starts the graphical desktop C) Switches the system to single-user (rescue) mode, stopping most services D) Shuts down the system immediately Answer: C Explanation: isolate changes the current target, stopping units not required by the specified target; rescue.target provides a minimal environment. Question 45. Which of the following is a permissive open-source license? A) GPLv B) LGPL C) MIT D) AGPL Answer: C Explanation: The MIT license allows reuse, modification, and redistribution with minimal restrictions, unlike copyleft licenses such as GPL. Question 46. The command find /var/log -type f -mtime -2 will: A) List files in /var/log modified within the last 2 days B) Delete files older than 2 minutes C) List directories modified within the last 2 hours D) Find files larger than 2 GB Answer: A Explanation: -type f selects regular files; -mtime -2 matches files modified less than 2*24 hours ago.

B) Enables extended pattern matching C) Disables error messages D) Starts the script in interactive mode Answer: A Explanation: set -e causes the script to terminate immediately if any command exits with a non-zero status. Question 51. Which of the following commands will list all loaded kernel modules? A) lsmod B) modprobe -l C) insmod -l D) depmod -a Answer: A Explanation: lsmod reads /proc/modules and displays currently loaded modules. Question 52. The hostnamectl set-hostname server01 command does what? A) Changes the system’s DNS resolver settings B) Sets the static hostname to “server01” and updates related configuration files C) Restarts the network service D) Changes the kernel hostname only for the current session Answer: B Explanation: hostnamectl writes the new hostname to /etc/hostname and informs systemd-hostnamed. Question 53. Which option to tar creates a compressed archive using gzip? A) -c -z B) -c -j C) -x -z D) -t -z Answer: A

Explanation: -c creates an archive; -z filters it through gzip. Question 54. What is the purpose of the rc.local file on many Linux systems? A) Define user login shells B) Run custom commands at the end of the multi-user boot process (legacy) C) Store kernel parameters D) List installed packages Answer: B Explanation: Historically, rc.local is executed after all normal init scripts, allowing administrators to add custom startup commands. Question 55. Which command will display the current system’s load averages? A) uptime B) top -b -n1 | grep load C) w D) All of the above Answer: D Explanation: uptime, top (in batch mode), and w all show the 1-, 5-, and 15 - minute load averages. Question 56. In a Linux filesystem, which of the following is true about the sticky bit on a directory such as /tmp? A) It prevents users from deleting or renaming files they do not own within that directory. B) It forces all files created in the directory to be executable. C) It encrypts the directory contents. D) It disables any write access to the directory. Answer: A Explanation: The sticky bit (t) on a directory restricts deletion/renaming to the file’s owner, the directory’s owner, or root.

C) DNS server entries D) Current firewall rules Answer: B Explanation: ip route show default filters the routing table to the default route, indicating the gateway. Question 61. In a Debian-based system, which command upgrades all installed packages to the newest versions available in configured repositories? A) apt-get install upgrade B) apt-get update && apt-get upgrade C) apt-get dist-upgrade D) apt-get refresh Answer: B Explanation: apt-get update refreshes package lists; apt-get upgrade upgrades packages without removing or installing new ones. Question 62. Which of the following is a correct way to append text to a file using redirection? A) echo "Hello" > file.txt B) echo "Hello" >> file.txt C) cat > file.txt "Hello" D) echo "Hello" | tee file.txt Answer: B Explanation: >> appends; > overwrites. Question 63. What is the effect of the kill -9 1234 command? A) Sends SIGTERM (graceful termination) to process 1234 B) Sends SIGKILL (forceful termination) to process 1234 C) Sends SIGSTOP (pause) to process 1234 D) Sends SIGUSR1 to process 1234 Answer: B

Explanation: Signal number 9 corresponds to SIGKILL, which cannot be caught or ignored. Question 64. Which command can be used to view the contents of a compressed gzip file without extracting it? A) cat file.gz B) less file.gz C) zcat file.gz D) gzip -d file.gz Answer: C Explanation: zcat streams the decompressed content to stdout. Question 65. Which of the following statements about the nice command is correct? A) It changes the priority of a running process. B) It launches a new process with a modified scheduling priority (niceness). C) It permanently changes the system’s default niceness value. D) It only works with root-owned processes. Answer: B Explanation: nice starts a command with a specified niceness value; renice modifies an existing process. Question 66. In systemd, what does the systemctl daemon-reload command do? A) Restarts all running services B) Reloads the systemd manager configuration files, applying changes to unit files C) Clears the journal logs D) Reboots the machine Answer: B Explanation: After editing unit files, daemon-reload makes systemd re-read them without a full reboot.