Docsity

LFS303 Linux for Cloud Technicians Practice Exam, Exams of Technology

Toggle sidebar
bg1
LFS303 Linux for Cloud Technicians
Practice Exam
**Question 1.** Which command searches for files named “report.txt” starting from the root
directory?
A) locate report.txt
B) find / -name report.txt
C) grep -r report.txt /
D) ls -R report.txt
Answer: B
Explanation: `find / -name report.txt` recursively searches the filesystem from `/` for files
matching the exact name.
**Question 2.** What does the `diff` command output when two files are identical?
A) The word “identical”
B) No output
C) A single line with “0 differences”
D) An error message
Answer: B
Explanation: `diff` produces no output if the compared files are the same, indicating no
differences.
**Question 3.** Which option creates a hard link named “linkfile” to an existing file
“sourcefile”?
A) ln -s sourcefile linkfile
B) ln sourcefile linkfile
C) cp sourcefile linkfile
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
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download LFS303 Linux for Cloud Technicians Practice Exam and more Exams Technology in PDF only on Docsity!

Practice Exam

Question 1. Which command searches for files named “report.txt” starting from the root directory? A) locate report.txt B) find / - name report.txt C) grep - r report.txt / D) ls - R report.txt Answer: B Explanation: find / - name report.txt recursively searches the filesystem from / for files matching the exact name. Question 2. What does the diff command output when two files are identical? A) The word “identical” B) No output C) A single line with “0 differences” D) An error message Answer: B Explanation: diff produces no output if the compared files are the same, indicating no differences. Question 3. Which option creates a hard link named “linkfile” to an existing file “sourcefile”? A) ln - s sourcefile linkfile B) ln sourcefile linkfile C) cp sourcefile linkfile

Practice Exam

D) mv sourcefile linkfile Answer: B Explanation: ln sourcefile linkfile creates a hard link; -s would create a symbolic link. Question 4. In Linux I/O redirection, what does 2>> error.log do? A) Overwrites error.log with stderr B) Appends stderr to error.log C) Redirects stdout to error.log D) Sends both stdout and stderr to error.log Answer: B Explanation: 2>> appends the standard error stream (file descriptor 2) to the specified file. Question 5. Which pipeline correctly counts the number of lines containing the word “failed” in /var/log/syslog? A) cat /var/log/syslog | wc - l | grep failed B) grep failed /var/log/syslog | wc - l C) wc - l /var/log/syslog | grep failed D) grep - c failed /var/log/syslog Answer: B Explanation: grep failed filters matching lines, and wc - l counts them. Option D also works but uses -c flag; B matches the pipeline requirement.

Practice Exam

Answer: A Explanation: s/foo/bar/ replaces the first match per line; adding g would replace all occurrences. Question 9. How would you display the last 20 lines of a log file and continue to follow new entries? A) tail - 20 - f /var/log/app.log B) tail - n 20 - F /var/log/app.log C) tail - f - n 20 /var/log/app.log D) tail - 20 /var/log/app.log Answer: C Explanation: tail - f - n 20 shows the last 20 lines and follows the file for new data. Question 10. Which command lists unique usernames from the /etc/passwd file, sorted alphabetically? A) cut - d: - f1 /etc/passwd | sort | uniq B) awk - F: '{print $1}' /etc/passwd | uniq | sort C) cat /etc/passwd | uniq - u | sort D) grep - o '^[^:]+' /etc/passwd | sort - u Answer: A Explanation: cut - d: - f1 extracts usernames, sort orders them, and uniq removes duplicates.

Practice Exam

Question 11. Which package manager uses the dnf command on modern Red Hat‑based systems? A) apt B) yum C) zypper D) dnf Answer: D Explanation: dnf (Dandified YUM) is the default package manager for Fedora, RHEL 8+, and CentOS 8+. Question 12. To add a new repository file for apt, which directory should you place it in? A) /etc/apt/sources.list.d/ B) /etc/yum.repos.d/ C) /usr/local/apt/repos/ D) /var/lib/apt/repo/ Answer: A Explanation: apt reads additional repository definitions from .list files in /etc/apt/sources.list.d/. Question 13. Which command creates a new user called “devops” with a home directory? A) useradd devops - m B) adduser devops --create-home C) useradd - m devops D) adduser - d /home/devops devops

Practice Exam

A) SUID bit, rwx for owner, rx for group and others B) SGID bit, rwx for owner, rx for group and others C) Sticky bit, rwx for owner, rx for group and others D) No special bits, just standard permissions Answer: A Explanation: The leading 4 sets the SUID bit; 755 gives rwx to owner and rx to group/others. Question 17. Which ACL command grants user “bob” read and write permissions on /data/project? A) setfacl - m u:bob:rw /data/project B) chmod u+bob:rw /data/project C) setfacl - x u:bob /data/project D) chown bob /data/project Answer: A Explanation: setfacl - m u:bob:rw modifies the ACL to give the specified permissions to user bob. Question 18. How can you view the current system time zone setting? A) timedatectl status | grep "Time zone" B) cat /etc/timezone C) date +%Z D) hwclock --show

Practice Exam

Answer: A Explanation: timedatectl status displays the time zone among other details; grepping isolates it. Question 19. Which service synchronizes the system clock with NTP servers on most modern Linux distributions? A) chronyd B) ntpd C) systemd-timesyncd D) timedatectl Answer: C Explanation: systemd-timesyncd is the lightweight NTP client enabled by default on many systemd‑based systems. Question 20. To assign a static IP address of 192.168.10.25/24 on interface eth0 using netplan, which YAML snippet is correct? A) network: version: 2 ethernets: eth0: addresses: [192.168.10.25/24] B) network:

Practice Exam

A) ip route list B) netstat - r C) route - n D) ip r Answer: D Explanation: ip r (short for ip route) shows the routing table succinctly; ip route list is equivalent but longer. Question 22. How would you test connectivity to a remote host “example.com” using ICMP with a timeout of 2 seconds? A) ping - c 1 - W 2 example.com B) ping - t 2 example.com C) ping - w 2 - n 1 example.com D) traceroute - w 2 example.com Answer: A Explanation: -c 1 sends one packet, -W 2 sets the timeout (seconds) for each reply. Question 23. Which ss option lists all listening TCP sockets? A) ss - t - a B) ss - t - l C) ss - l - u D) ss - a - p

Practice Exam

Answer: B Explanation: -t limits to TCP, -l shows listening sockets. Question 24. To restrict SSH login to the group “admin”, which line should be added to /etc/ssh/sshd_config? A) AllowGroups admin B) PermitGroup admin C) Group admin D) AllowUsers @admin Answer: A Explanation: AllowGroups specifies which Unix groups are permitted to log in via SSH. Question 25. Which command disables a systemd service called “httpd” without removing it? A) systemctl stop httpd B) systemctl disable httpd C) systemctl mask httpd D) systemctl deactivate httpd Answer: B Explanation: disable prevents the service from starting at boot while leaving it installed; stop only halts the current instance. Question 26. How can you view the logs of the “nginx” service using journalctl? A) journalctl - u nginx.service

Practice Exam

Explanation: Systemd timers trigger units based on calendar or monotonic time, acting as a modern replacement for cron. Question 29. Which command creates a 2 GB partition on /dev/sdb using fdisk? A) fdisk /dev/sdb (then n, +2G) B) fdisk - l /dev/sdb 2G C) mkfs.ext4 - L 2G /dev/sdb D) partprobe /dev/sdb 2G Answer: A Explanation: fdisk interactive mode allows creating a new partition (n) and specifying size (+2G). Question 30. To format a newly created partition /dev/sdc1 with the XFS filesystem, which command is correct? A) mkfs.xfs /dev/sdc B) mkfs - t xfs /dev/sdc C) format - X /dev/sdc D) xfs_admin - i /dev/sdc Answer: A Explanation: mkfs.xfs directly creates an XFS filesystem on the device. Question 31. Which entry added to /etc/fstab will mount /dev/sdd1 at /mnt/data with defaults and enable auto‑mount at boot? A) /dev/sdd1 /mnt/data ext4 defaults 0 2

Practice Exam

B) /dev/sdd1 /mnt/data ext4 auto 0 0 C) UUID=xxxx /mnt/data ext4 defaults 0 2 D) /dev/sdd1 /mnt/data ext4 defaults,noauto 0 2 Answer: A Explanation: The defaults option enables typical mount settings; the last two fields (0 2) control dump and fsck order, allowing auto‑mount. Question 32. How can you display the amount of swap currently used? A) free - h | grep Swap B) swapon - s C) cat /proc/swaps D) vmstat - s | grep swap Answer: A Explanation: free - h shows a summary including total and used swap; grepping isolates the line. Question 33. Which command checks the health of an NFS mount point /mnt/share? A) nfsstat - m /mnt/share B) mount - v /mnt/share C) showmount - e /mnt/share D) df - h /mnt/share Answer: A

Practice Exam

B) A snapshot of a container’s filesystem and metadata C) The network stack of a container D) A virtual machine image Answer: B Explanation: An image is a read‑only template that includes the filesystem, libraries, and configuration used to create containers. Question 37. Which command displays logs for a container named “webapp” using Docker? A) docker logs webapp B) podman log webapp C) docker inspect --log webapp D) docker view logs webapp Answer: A Explanation: docker logs retrieves the stdout/stderr of the specified container. Question 38. Which Kubernetes object defines a desired number of pod replicas? A) Service B) Deployment C) ConfigMap D) Ingress Answer: B

Practice Exam

Explanation: A Deployment’s spec includes replicas, controlling how many pod instances should run. Question 39. Which Git command creates a new branch called “feature‑x” and switches to it? A) git branch feature-x && git checkout feature-x B) git checkout - b feature-x C) git switch - c feature-x D) Both B and C Answer: D Explanation: git checkout - b and git switch - c both create and switch to a new branch. Question 40. After modifying a file, which sequence correctly stages and commits the change with the message “Update config”? A) git add. ; git commit - m "Update config" B) git commit - a - m "Update config" C) git stage. ; git commit - m "Update config" D) git add - A ; git commit Answer: A Explanation: git add . stages all changes; git commit - m creates the commit with the given message. Option B also works but bypasses explicit staging; however the question asks for a “sequence” that includes staging. Question 41. Which remote URL format is used for HTTPS cloning from GitHub?

Practice Exam

Answer: A Explanation: set - x prints each command and its arguments after expansion, useful for tracing. Question 44. How would you loop over all .conf files in /etc and echo their names? A) for f in /etc/.conf; do echo $f; done B) while read f; do echo $f; done < /etc/.conf C) ls /etc/.conf | while read f; do echo $f; done D) find /etc - name ".conf" - exec echo {} ; Answer: A Explanation: The simple for loop iterates over the glob pattern and echoes each filename. Question 45. Which command captures the output of df - h and saves it to a variable called usage? A) usage=$(df - h) B) usage=df - h C) usage=$( "df - h" ) D) Both A and B Answer: D Explanation: Both command substitution syntaxes ($(…) and backticks) store the command output in a variable. Question 46. What does the -p flag do in mkdir - p /opt/app/logs? A) Sets permissions to 777

Practice Exam

B) Creates parent directories as needed C) Prompts before creating each directory D) Preserves existing files Answer: B Explanation: -p tells mkdir to create any missing intermediate directories without error. Question 47. Which file contains the kernel ring buffer messages that can be viewed with dmesg? A) /var/log/kern.log B) /proc/kmsg C) /sys/kernel/debug/dmesg D) /var/log/messages Answer: B Explanation: /proc/kmsg is the interface to the kernel’s message buffer; dmesg reads from it. Question 48. To display the last 5 boot entries from the system journal, which command is correct? A) journalctl - b - 5 B) journalctl - b - n 5 C) journalctl --boot=- 5 D) journalctl - b --lines= Answer: D