Docsity

LFS207 Linux System Administration Essentials Practice Exam, Exams of Technology

Toggle sidebar
bg1
LFS207 Linux System Administration
Essentials Practice Exam
**Question 1.** Which directory defined by the Filesystem Hierarchy Standard (FHS) contains
system-wide configuration files?
A) /usr/local
B) /etc
C) /var
D) /opt
Answer: B
Explanation: /etc is the standard location for host-specific system configuration files according
to the FHS.
**Question 2.** In Bash, which variable stores the current user's home directory?
A) $PATH
B) $HOME
C) $USER
D) $PWD
Answer: B
Explanation: $HOME is automatically set to the absolute path of the invoking user's home
directory.
**Question 3.** Which command creates a new user named “alice” with a home directory and
default shell /bin/bash?
A) useradd -m -s /bin/bash alice
B) adduser alice –create-home –shell /bin/bash
C) newuser –home /home/alice –shell /bin/bash alice
D) mkuser -d /home/alice -s /bin/bash alice
Answer: A
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
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59

Partial preview of the text

Download LFS207 Linux System Administration Essentials Practice Exam and more Exams Technology in PDF only on Docsity!

Essentials Practice Exam

Question 1. Which directory defined by the Filesystem Hierarchy Standard (FHS) contains system-wide configuration files? A) /usr/local B) /etc C) /var D) /opt Answer: B Explanation: /etc is the standard location for host-specific system configuration files according to the FHS. Question 2. In Bash, which variable stores the current user's home directory? A) $PATH B) $HOME C) $USER D) $PWD Answer: B Explanation: $HOME is automatically set to the absolute path of the invoking user's home directory. Question 3. Which command creates a new user named “alice” with a home directory and default shell /bin/bash? A) useradd - m - s /bin/bash alice B) adduser alice – create-home – shell /bin/bash C) newuser – home /home/alice – shell /bin/bash alice D) mkuser - d /home/alice - s /bin/bash alice Answer: A

Essentials Practice Exam

Explanation: useradd - m creates the home directory; - s specifies the login shell. Question 4. To add an existing user “bob” to the group “developers”, which command is correct? A) usermod - a - G developers bob B) groupadd - a - U developers bob C) adduser bob developers D) gpasswd - a bob developers Answer: A Explanation: usermod - a - G appends the user to supplementary groups without removing existing memberships. Question 5. What permission set on a directory allows users to delete only their own files while preventing others from removing any files? A) 777 B) 755 C) 1775 D) 2755 Answer: C Explanation: The sticky bit (1) on a directory (e.g., 1775) permits file deletion only by the file owner, directory owner, or root. Question 6. Which special permission bit makes an executable run with the privileges of its owner? A) setuid B) setgid

Essentials Practice Exam

C) /etc/pacman.conf D) /etc/apt/apt.conf.d/ Answer: A Explanation: /etc/apt/sources.list and files in /etc/apt/sources.list.d/ define APT repositories. Question 10. On a Red Hat system, which command removes a package named “httpd” and all its dependencies that are no longer required? A) rpm - e httpd B) yum remove httpd && yum autoremove C) dnf erase httpd --remove-leaves D) zypper rm httpd – clean-deps Answer: C Explanation: dnf erase (or remove) with --remove-leaves deletes the package and any orphaned dependencies. Question 11. Which command updates the package index on a SUSE system using zypper? A) zypper refresh B) zypper update‑repo C) zypper repo‑refresh D) zypper sync Answer: A Explanation: zypper refresh reloads repository metadata, similar to apt update. Question 12. In Git, which command stages all modified and deleted files for the next commit? A) git commit - a

Essentials Practice Exam

B) git add. C) git add - A D) git stage * Answer: C Explanation: git add - A stages new, modified, and deleted files, preparing them for commit. Question 13. Which Git command creates a new branch named “featureX” and switches to it? A) git branch featureX && git checkout featureX B) git checkout - b featureX C) git switch - c featureX D) Both B and C are correct Answer: D Explanation: Both git checkout - b and git switch - c create and switch to a new branch. Question 14. What does the “Z” state indicate for a Linux process? A) Zombie – terminated but not reaped B) Stopped – waiting for a signal C) Sleeping – waiting for I/O D) Running – actively using CPU Answer: A Explanation: A zombie process has completed execution but still has an entry in the process table until its parent reaps it. Question 15. Which command shows a real‑time view of processes sorted by CPU usage?

Essentials Practice Exam

Question 18. Which command displays free and used memory in a human‑readable format? A) free - m B) vmstat - s C) top – b – n1 | grep Mem D) cat /proc/meminfo | grep MemTotal Answer: A Explanation: free - m reports memory in megabytes; add - h for human‑readable units. Question 19. To enable a swap file located at /swapfile, which sequence is correct? A) mkswap /swapfile && swapon /swapfile B) dd if=/dev/zero of=/swapfile bs=1M count=1024 && swapon /swapfile C) chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile D) All of the above (assuming file already exists) Answer: C Explanation: Swap files must have correct permissions (600), be initialized with mkswap, then activated with swapon. Question 20. Which command shows I/O statistics for each block device? A) iostat - dx B) vmstat - d C) dstat – disk D) sar - d 1 3 Answer: A Explanation: iostat - dx provides extended device utilization and throughput metrics.

Essentials Practice Exam

Question 21. To monitor real‑time disk I/O of processes, which utility is most suitable? A) iotop B) top C) vmstat D) df Answer: A Explanation: iotop displays per‑process I/O usage in an interactive interface. Question 22. Which command displays the amount of free space on each mounted filesystem? A) df - h B) du - sh /* C) lsblk – fs D) mount – show Answer: A Explanation: df - h reports filesystem disk space usage in human‑readable units. Question 23. Docker containers are built from images using which file format? A) Dockerfile B) Containerfile C) image.yaml D) Both A and B are accepted names Answer: D Explanation: Docker accepts either Dockerfile or Containerfile as the build instruction file.

Essentials Practice Exam

Explanation: In fdisk, the “o” command creates a new empty DOS partition table. Question 27. When using gdisk, which partition type code corresponds to Linux LVM? A) 8300 B) 8e C) 8302 D) 8200 Answer: B Explanation: 8e00 is the GUID partition type for Linux LVM in GPT. Question 28. Which command checks and repairs an EXT4 filesystem on /dev/sda1? A) fsck.ext4 /dev/sda B) e2fsck - p /dev/sda C) mkfs.ext4 - n /dev/sda D) Both A and B are valid Answer: D Explanation: Both fsck.ext4 and e2fsck perform consistency checks on EXT4 filesystems. Question 29. What attribute does the “chattr +i” command set on a file? A) Immutable – file cannot be modified or deleted B) Append‑only – only data can be added C) No‑dump – skip during backups D) Secure deletion flag Answer: A

Essentials Practice Exam

Explanation: The +i attribute makes the file immutable; even root cannot modify or unlink it without first removing the attribute. Question 30. Which mount option disables the execution of binaries on the mounted filesystem? A) noexec B) nosuid C) nodev D) ro Answer: A Explanation: The noexec option prevents execution of any binaries on that mount point. Question 31. What does the “tune2fs - c 0” command do on an EXT4 filesystem? A) Disables the maximum mount count limit B) Sets the maximum number of inodes to zero C) Clears the journal D) Enables lazy inode table initialization Answer: A Explanation: - c 0 disables the check of the maximum mount count, effectively turning off that limit. Question 32. Which command creates a new logical volume named “lv_data” of size 20 GB in volume group “vg_main”? A) lvcreate - L 20G - n lv_data vg_main B) vgcreate - L 20G - n lv_data vg_main C) lvm create – size 20G – name lv_data vg_main

Essentials Practice Exam

A) insmod dm_mod.ko B) modprobe dm_mod C) lsmod | grep dm_mod D) Both A and B (but B handles dependencies) Answer: B Explanation: modprobe loads a module and resolves any dependencies; insmod only loads the specified .ko file. Question 36. To permanently blacklist the “floppy” kernel module, which file should be edited? A) /etc/modprobe.d/blacklist.conf B) /etc/modules-load.d/blacklist.conf C) /etc/rc.local D) /etc/sysctl.conf Answer: A Explanation: Adding “blacklist floppy” to /etc/modprobe.d/blacklist.conf prevents the module from being auto‑loaded. Question 37. Which command displays the current kernel version? A) uname - r B) cat /proc/version C) dmesg | grep Linux D) All of the above Answer: D Explanation: All three commands provide the kernel version; uname - r is the most concise.

Essentials Practice Exam

Question 38. The device file /dev/sda represents which type of device? A) Block device – primary hard disk B) Character device – serial port C) Pseudo‑device – random number generator D) Network interface – eth Answer: A Explanation: /dev/sda is the first SCSI/SATA disk, a block device. Question 39. Which udev rule matches all USB storage devices and sets the permission mode to 660? A) SUBSYSTEM=="block", ATTRS{idVendor}=="", MODE="0660" B) ACTION=="add", KERNEL=="sd[a-z]", ATTRS{removable}=="1", MODE="0660" C) SUBSYSTEM=="usb", ATTR{idProduct}=="", MODE="0660" D) KERNEL=="sd*", SUBSYSTEM=="block", MODE="0660" Answer: D Explanation: The rule matches block devices whose kernel name starts with “sd”, typical for USB storage, and sets mode 660. Question 40. To assign a static IPv4 address 192.168.10.25/24 to interface eth0 using the ip command, which syntax is correct? A) ip addr add 192.168.10.25/24 dev eth B) ifconfig eth0 192.168.10.25 netmask 255.255.255.0 up C) ip link set eth0 address 192.168.10.25/ D) Both A and B (they achieve the same result) Answer: A

Essentials Practice Exam

Answer: C Explanation: The “uid” attribute holds the unique identifier used for login; uidNumber is a numeric ID. Question 44. To enable LDAP authentication on a Debian system, which package must be installed? A) openldap‑clients B) libpam‑ldapd C) sssd D) nslcd Answer: B Explanation: libpam‑ldapd provides PAM modules for LDAP authentication; openldap‑clients supplies tools, but PAM integration requires libpam‑ldapd. Question 45. Which iptables target drops packets silently without sending an ICMP reply? A) REJECT B) DROP C) LOG D) ACCEPT Answer: B Explanation: DROP discards packets with no response; REJECT sends an ICMP error. Question 46. To allow incoming SSH (tcp/22) connections only from the 10.0.0.0/8 network using firewalld, which command is correct? A) firewall-cmd --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" service name="ssh" accept' --permanent

Essentials Practice Exam

B) firewall-cmd --add-service=ssh --source=10.0.0.0/8 --permanent C) iptables - A INPUT - s 10.0.0.0/8 - p tcp --dport 22 - j ACCEPT D) Both A and C (but A uses firewalld) Answer: A Explanation: firewalld’s rich‑rule syntax precisely expresses source‑restricted acceptance. Question 47. Which systemd unit type is used for one‑time tasks that run after boot and then exit? A) service B) target C) timer D) socket Answer: A Explanation: A service unit can be configured with Type=oneshot to run a single task and then finish. Question 48. To view the dependency tree of the systemd unit “multi‑user.target”, which command should be used? A) systemctl list-dependencies multi-user.target B) systemctl status multi-user.target – show‑dependencies C) journalctl - u multi-user.target – tree D) systemd-analyze plot > graph.svg Answer: A Explanation: systemctl list-dependencies prints the unit’s dependency hierarchy.

Essentials Practice Exam

Explanation: Permissive mode records denials in the audit log while allowing the actions. Question 52. Which command temporarily places SELinux into permissive mode until the next reboot? A) setenforce 0 B) semanage permissive - a ` C) selinuxenabled – perm D) auditctl - e 0 Answer: A Explanation: setenforce 0 switches the current SELinux mode to permissive. Question 53. AppArmor profiles are stored in which directory on Ubuntu? A) /etc/apparmor.d/ B) /etc/selinux/ C) /usr/share/apparmor/ D) /var/lib/apparmor/ Answer: A Explanation: /etc/apparmor.d/ contains the individual profile files. Question 54. To boot a system into rescue mode using systemd, which kernel parameter is added? A) systemd.unit=rescue.target B) init=/bin/sh C) emergency D) single

Essentials Practice Exam

Answer: A Explanation: systemd.unit=rescue.target tells systemd to start the rescue target instead of the default. Question 55. Which command restores the GRUB configuration after reinstalling the bootloader on a BIOS system? A) grub2-install /dev/sda && grub2-mkconfig - o /boot/grub2/grub.cfg B) grub-install /dev/sda && update-grub C) grub2-mkconfig - o /boot/grub/grub.cfg D) Both A and B are valid depending on distribution Answer: D Explanation: Debian/Ubuntu use grub-install + update-grub; RHEL/Fedora use grub2-install + grub2-mkconfig. Question 56. Which file contains the static mapping of hostnames to IP addresses on a Linux system? A) /etc/hosts B) /etc/resolv.conf C) /etc/nsswitch.conf D) /etc/hostname Answer: A Explanation: /etc/hosts provides local hostname‑to‑IP resolution before DNS. Question 57. To change the system’s hostname permanently on a system using systemd, which command should be executed? A) hostnamectl set-hostname newhost.example.com