


















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



















































































Question 1. Which file is read by Bash for login shells to set environment variables? A) ~/.bashrc B) ~/.bash_profile C) /etc/profile.d/* D) ~/.bash_logout Answer: B Explanation: Bash reads ~/.bash_profile (or ~/.profile) for login shells to initialize environment variables and run commands. Question 2. In a Bash script, which construct correctly loops over all positional parameters? A) for i in $*; do …; done B) for i in "$@"; do …; done C) while [ $# - gt 0 ]; do …; shift; done D) both B and C Answer: D Explanation: "$@" expands each positional parameter as a separate word, and the while‑shift pattern also iterates over parameters. Question 3. Which command displays the amount of free and used inodes on each mounted filesystem? A) df - i B) du - i C) ls - i D) inodeinfo Answer: A Explanation: df - i reports inode usage per filesystem, similar to df for blocks.
Question 4. When creating a new ext4 filesystem, which option enables the metadata checksums for increased reliability? A) - O metadata_csum B) - O checksum C) - J lazy_itable_init= D) - E lazy_itable_init= Answer: A Explanation: The - O metadata_csum option turns on metadata checksums in ext4. Question 5. Which udev rule attribute matches a USB device by its vendor ID 0x1234? A) ATTR{idVendor}=="1234" B) ENV{ID_VENDOR_ID}=="1234" C) SUBSYSTEM=="usb", ATTR{idVendor}=="1234" D) KERNEL=="usb*", ATTR{idVendor}=="0x1234" Answer: C Explanation: udev rules typically specify SUBSYSTEM and attribute matching; the vendor ID is compared as a string without the 0x prefix. Question 6. In mdadm, which parameter specifies the number of devices that can be used as hot spares? A) --spare-devices B) --raid-devices C) --bitmap=internal D) --level=spare Answer: A
Explanation: RAID 10 (or 1+0) combines mirroring (RAID 1) and striping (RAID 0) for performance and redundancy. Question 10. Which command schedules a cron job to run a script every Monday at 02:30? A) 30 2 * * 1 /path/script.sh B) 2 30 * * Mon /path/script.sh C) 30 02 * * Mon /path/script.sh D) 02:30 * * 1 /path/script.sh Answer: A Explanation: Cron syntax is minute hour day month weekday; “30 2 * * 1” runs at 02:30 on Monday. Question 11. Which of the following iptables targets drops a packet and logs the event? A) DROP B) REJECT C) LOG D) DROP, LOG (two separate rules) Answer: D Explanation: iptables can only use one target per rule; to drop and log you need a LOG rule followed by a DROP rule. Question 12. In systemd, which unit file type is used for a one‑shot task that runs at boot and then exits? A) service B) timer C) target
D) socket Answer: A Explanation: A service unit with Type=oneshot runs a command once during boot and then terminates. Question 13. Which option to the mount command makes the filesystem read‑only? A) - r B) - o ro C) - o readonly D) - ro Answer: B Explanation: The mount option “ro” (read‑only) is passed via - o. Question 14. Which command displays the current SELinux mode? A) sestatus – b B) getenforce C) selinux‑status D) seinfo – mode Answer: B Explanation: getenforce returns “Enforcing”, “Permissive”, or “Disabled”. Question 15. In a BIND zone file, which record type maps an IPv6 address to a hostname? A) A B) AAAA C) PTR
Answer: A Explanation: DISTINCT eliminates duplicate rows in the result set. Question 19. Which of the following files defines static IPv4 address configuration for a network interface on RHEL 8? A) /etc/sysconfig/network-scripts/ifcfg‑eth B) /etc/network/interfaces C) /etc/netplan/01‑netcfg.yaml D) /etc/NetworkManager/system-connections/eth0.nmconnection Answer: A Explanation: RHEL 8 (and its successors) use ifcfg files under /etc/sysconfig/network-scripts. Question 20. Which netlink utility can be used to display current bonding interfaces and their status? A) ip link show bond B) cat /proc/net/bonding/bond C) bondctl status D) ifconfig - a bond Answer: B Explanation: /proc/net/bonding/ provides detailed bonding information. Question 21. Which command can be used to view the kernel ring buffer for recent boot messages? A) dmesg B) journalctl - k
C) syslogd - p D) kernlog Answer: A Explanation: dmesg prints the kernel’s ring buffer, which contains boot messages. Question 22. In systemd, which command reloads unit files after they have been edited? A) systemctl daemon-reload B) systemctl reload‑units C) systemctl restart systemd‑logind D) systemctl reload‑config Answer: A Explanation: daemon-reload tells systemd to re‑read unit files. Question 23. Which option to the rsync command preserves symbolic links as links rather than copying the files they point to? A) - l B) - L C) - a D) - p Answer: A Explanation: - l (or --links) copies symlinks as symlinks; - L follows them. Question 24. Which of the following is the correct way to add a static route for network 10.0.0.0/24 via gateway 192.168.1.1 using the ip command? A) ip route add 10.0.0.0/24 via 192.168.1.1 dev eth B) route add - net 10.0.0.0/24 gw 192.168.1.1 eth
C) pam_limits.so D) pam_tally2.so Answer: B Explanation: pam_cracklib (or pam_pwquality) checks password strength and complexity. Question 28. Which command creates a snapshot of an LVM logical volume named lv_home? A) lvcreate - s - n snap_home - L 1G /dev/vg0/lv_home B) lvcreate - p - n snap_home - L 1G /dev/vg0/lv_home C) lvcreate - r - n snap_home - L 1G /dev/vg0/lv_home D) lvcreate - c - n snap_home - L 1G /dev/vg0/lv_home Answer: A Explanation: - s creates a snapshot; - n names it; - L sets its size. Question 29. Which of the following is the correct syntax to append a line to /etc/hosts using sudo and a single command? A) sudo echo "10.0.0.5 myhost" >> /etc/hosts B) echo "10.0.0.5 myhost" | sudo tee - a /etc/hosts C) sudo sh - c 'echo "10.0.0.5 myhost" >> /etc/hosts' D) both B and C Answer: D Explanation: Redirection occurs in the shell; using sudo only on echo does not affect the redirection. Both B (tee) and C (sh - c) work. Question 30. Which system call is used by the kernel to load a module into memory? A) insmod()
B) modprobe() C) sys_init_module() D) load_module() Answer: C Explanation: The kernel provides the sys_init_module system call; insmod and modprobe are user‑space utilities that invoke it. Question 31. Which option to the tar command creates a gzipped archive while preserving permissions? A) - czpf B) - czvf C) - cZpf D) - cJpf Answer: A Explanation: - c create, - z gzip, - p preserve permissions, - f specifies file name. Question 32. Which of the following is the default runlevel for most modern systemd‑based distributions? A) 3 B) 5 C) graphical.target D) multi‑user.target Answer: C Explanation: systemd uses targets; graphical.target is the default for systems that start a GUI.
Explanation: systemctl is the systemd control command; other options are for SysV init. Question 36. Which firewall backend replaces iptables in recent Fedora releases? A) firewalld B) nftables C) ipfw D) ufw Answer: B Explanation: nftables is the kernel‑level replacement; firewalld is a management daemon that can use nftables. Question 37. Which command displays the current SELinux boolean values? A) getsebool - a B) semanage boolean - l C) sesearch - b D) sebool - l Answer: A Explanation: getsebool - a lists all booleans and their current settings. Question 38. Which of the following is the correct syntax to add a new repository to a yum configuration file? A) echo "[myrepo]" >> /etc/yum.repos.d/myrepo.repo B) cat > /etc/yum.repos.d/myrepo.repo <
enabled= gpgcheck= EOF C) yum-config-manager --add-repo http://example.com/repo/ D) all of the above Answer: D Explanation: All three methods add a repo definition to yum. Question 39. Which of the following commands will display the current CPU frequency scaling governor? A) cpufreq-info - g B) cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor C) lscpu | grep Governor D) all of the above Answer: D Explanation: Each command provides the scaling governor; cpufreq-info may need the cpufrequtils package. Question 40. Which of the following is NOT a valid systemd unit type? A) service B) socket C) device D) daemon Answer: D Explanation: systemd defines service, socket, device, mount, automount, swap, target, timer, path, and slice units; “daemon” is not a unit type.
Explanation: uname - r prints only the release string. Question 44. In a Btrfs filesystem, which command creates a subvolume named “proj” at the mount point /mnt/btrfs? A) btrfs subvolume create /mnt/btrfs/proj B) btrfs subvol create /mnt/btrfs/proj C) btrfs subvolume add /mnt/btrfs/proj D) btrfs mkvol /mnt/btrfs/proj Answer: A Explanation: The command is “btrfs subvolume create”. Question 45. Which of the following is the default file permission mask applied when a new file is created by a user whose umask is 022? A) 644 B) 664 C) 755 D) 777 Answer: A Explanation: Default mode is 666; subtract umask 022 → 644. Question 46. Which command can be used to view the contents of a binary file in a human‑readable hexadecimal format? A) hexdump - C file.bin B) od - x file.bin C) xxd file.bin D) all of the above
Answer: D Explanation: All three produce hex dumps. Question 47. Which of the following is the correct way to enable a systemd timer called backup.timer on boot? A) systemctl enable backup.timer B) systemctl start backup.timer C) systemctl enable --now backup.timer D) both A and C Answer: D Explanation: enable makes it start at boot; enable --now also starts it immediately. Question 48. In an Ansible playbook, which keyword is used to execute a task only when a variable $foo equals “bar”? A) when: foo == "bar" B) condition: foo == "bar" C) only_if: foo == "bar" D) check: foo == "bar" Answer: A Explanation: The “when” clause evaluates Jinja2 expressions. Question 49. Which command lists all loaded kernel modules along with their size? A) lsmod B) modinfo - l C) cat /proc/modules D) both A and C
C) %admin ALL=(ALL) PASSWD: ALL D) %admin ALL=NOPASSWD: ALL Answer: A Explanation: The % prefix denotes a group; NOPASSWD disables the password prompt. Question 53. Which command can be used to generate a cryptographic hash of a file using SHA‑256? A) sha256sum file.txt B) md5sum file.txt C) openssl sha256 file.txt D) both A and C Answer: D Explanation: sha256sum and openssl sha256 both compute SHA‑256 digests. Question 54. In a system using systemd‑timesyncd, which file contains the NTP server list? A) /etc/systemd/timesyncd.conf B) /etc/ntp.conf C) /etc/systemd/system/timesyncd.service.d/override.conf D) /etc/chrony.conf Answer: A Explanation: timesyncd reads its configuration from /etc/systemd/timesyncd.conf. Question 55. Which of the following commands will display the current SELinux context of the file /etc/passwd? A) ls - Z /etc/passwd B) getenforce /etc/passwd
C) seinfo - f /etc/passwd D) context /etc/passwd Answer: A Explanation: ls - Z shows SELinux security contexts. Question 56. Which of the following is the correct syntax to create a new IPv6 address on interface eth0 using the ip command? A) ip - 6 addr add 2001:db8::1/64 dev eth B) ip addr add 2001:db8::1/64 dev eth C) ifconfig eth0 inet6 add 2001:db8::1/ D) both A and B Answer: A Explanation: The - 6 flag forces IPv6; ip addr add without - 6 defaults to IPv4. Question 57. Which of the following commands will display the list of installed packages on a Debian‑based system? A) dpkg - l B) rpm - qa C) yum list installed D) pacman - Qs Answer: A Explanation: dpkg - l lists installed Debian packages. Question 58. Which of the following is the proper way to set a persistent static route on a RHEL 8 system? A) echo "192.168.10.0/24 via 10.0.0.1 dev eth0" >> /etc/sysconfig/network-scripts/route‑eth