Docsity

LFS203 Linux for Cloud Technicians Essentials Practice Exam, Exams of Technology

Toggle sidebar
bg1
LFS203 Linux for Cloud Technicians Essentials
Practice Exam
**Question 1.** Which command recursively searches for files named “report.txt” starting from
the current directory?
A) find . -name report.txt
B) grep -r report.txt .
C) locate report.txt
D) ls -R report.txt
Answer: A
Explanation: `find . -name report.txt` searches from the current directory (.) recursively for files
with the exact name “report.txt”.
**Question 2.** To compare two binary files and report only whether they differ, which utility is
most appropriate?
A) diff
B) cmp
C) md5sum
D) cat
Answer: B
Explanation: `cmp` compares two files byte‑by‑byte and exits with a status indicating if they
differ, without producing a detailed diff.
**Question 3.** Which command displays the first 20 lines of a log file named “syslog”?
A) head -n 20 syslog
B) tail -n 20 syslog
C) less +20 syslog
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 LFS203 Linux for Cloud Technicians Essentials Practice Exam and more Exams Technology in PDF only on Docsity!

Practice Exam

Question 1. Which command recursively searches for files named “report.txt” starting from the current directory? A) find. - name report.txt B) grep - r report.txt. C) locate report.txt D) ls - R report.txt Answer: A Explanation: find. - name report.txt searches from the current directory (.) recursively for files with the exact name “report.txt”. Question 2. To compare two binary files and report only whether they differ, which utility is most appropriate? A) diff B) cmp C) md5sum D) cat Answer: B Explanation: cmp compares two files byte‑by‑byte and exits with a status indicating if they differ, without producing a detailed diff. Question 3. Which command displays the first 20 lines of a log file named “syslog”? A) head - n 20 syslog B) tail - n 20 syslog C) less +20 syslog

Practice Exam

D) cat syslog | head 20 Answer: A Explanation: head - n 20 syslog prints the first 20 lines; -n specifies the number of lines. Question 4. In a pipeline, what does the pipe symbol “|” do? A) Redirects output to a file. B) Sends standard error to another command. C) Connects the standard output of the left command to the standard input of the right command. D) Executes two commands simultaneously. Answer: C Explanation: The pipe passes the stdout of the command on the left as stdin to the command on the right. Question 5. Which redirection operator appends output to an existing file without overwriting it? A) > B) >> C) < D) << Answer: B Explanation: >> appends; > overwrites; < is input redirection.

Practice Exam

Answer: A Explanation: $3 refers to the third field; default field separator is whitespace. Question 9. To create a gzipped tar archive named backup.tar.gz containing the directory /var/www, which command is correct? A) tar - czf backup.tar.gz /var/www B) tar - cz backup.tar.gz /var/www C) gzip - c tar /var/www > backup.tar.gz D) tar - cvzf backup.tar.gz /var/www Answer: A Explanation: -c creates, -z filters through gzip, -f specifies the filename. Question 10. Which command extracts only the file “config.yaml” from archive app.tar without extracting other members? A) tar - xf app.tar config.yaml B) tar - xzvf app.tar config.yaml C) tar - tvf app.tar config.yaml D) tar - cf app.tar config.yaml Answer: A Explanation: -x extracts; specifying the filename after the archive extracts only that member. Question 11. What does the command ln - s /opt/app/current /usr/local/bin/app accomplish? A) Creates a hard link named app pointing to the target.

Practice Exam

B) Creates a symbolic link named app that points to /opt/app/current. C) Moves the file /opt/app/current to /usr/local/bin/app. D) Copies the file /opt/app/current to /usr/local/bin/app. Answer: B Explanation: -s creates a soft (symbolic) link; the link name is the last argument. Question 12. Which octal permission value gives read and execute rights to the owner, and read‑only rights to group and others? A) 755 B) 644 C) 511 D) 744 Answer: D Explanation: Owner rwx = 7, group r = 4, others r = 4 → 744. Question 13. To change the group ownership of file “report.pdf” to “audit”, which command is used? A) chown :audit report.pdf B) chgrp audit report.pdf C) chmod g+audit report.pdf D) chown audit report.pdf Answer: A

Practice Exam

B) mkfs.ext4 /dev/sdb C) fdisk - t ext4 /dev/sdb D) format /dev/sdb1 ext Answer: B Explanation: mkfs.ext4 is the dedicated tool; mkfs - t ext4 also works but the most direct is mkfs.ext4. Question 17. After partitioning a disk, which command refreshes the kernel’s view of the partition table without rebooting? A) partprobe B) fdisk - l C) lsblk D) blkid Answer: A Explanation: partprobe forces the kernel to re‑read the partition table. Question 18. To mount the filesystem on /dev/sdc2 at /mnt/data temporarily, which command is correct? A) mount /dev/sdc2 /mnt/data B) mount /mnt/data /dev/sdc C) mount - t ext4 /dev/sdc2 /mnt/data D) mount - a /dev/sdc2 /mnt/data Answer: A

Practice Exam

Explanation: General syntax is mount <device> <mount‑point>; specifying type is optional if detectable. Question 19. Which entry in /etc/fstab will mount a NFS share at boot with read‑only permissions? A) server:/share /mnt nfs ro 0 0 B) server:/share /mnt nfs defaults,ro 0 0 C) server:/share /mnt nfs rw 0 0 D) server:/share /mnt nfs auto 0 0 Answer: B Explanation: defaults,ro includes default options plus read‑only; ro alone is not a valid option list. Question 20. Which command shows the amount of used and available disk space on all mounted filesystems in human‑readable format? A) df - h B) du - h C) lsblk - h D) fdisk - h Answer: A Explanation: df - h reports filesystem space usage with sizes in KiB/MiB/GiB. Question 21. To create a new local user called “devops” with a home directory, which command is appropriate? A) useradd - m devops

Practice Exam

Explanation: passwd - e expires the password; chage - d 0 sets last change date to epoch, both cause a prompt on next login. Question 24. Which command lists all groups defined on the system? A) getent group B) cat /etc/group C) groups - a D) Both A and B Answer: D Explanation: getent group queries the NSS database; cat /etc/group directly shows the file. Both produce the group list. Question 25. To add user “bob” to the supplementary group “docker”, which command is correct? A) usermod - aG docker bob B) gpasswd - a bob docker C) adduser bob docker D) all of the above Answer: D Explanation: All three commands achieve the same result on various distributions. Question 26. Which command displays the current system time in UTC? A) date - u B) timedatectl show --property=Timezone

Practice Exam

C) hwclock --utc --show D) clock - u Answer: A Explanation: date - u prints the time in Coordinated Universal Time. Question 27. Which service synchronizes the system clock with remote NTP servers? A) chronyd B) ntpd C) systemd-timesyncd D) any of the above Answer: D Explanation: All listed daemons provide NTP synchronization; the choice depends on distribution. Question 28. To view the contents of /etc/resolv.conf, which command is appropriate? A) cat /etc/resolv.conf B) resolveconf - l C) dnslookup /etc/resolv.conf D) nslookup Answer: A Explanation: cat simply displays the file; the other commands are unrelated.

Practice Exam

Answer: D Explanation: Each command can list listening TCP sockets with associated process IDs. Question 32. When troubleshooting DNS resolution, which command queries a specific DNS server for the A record of “example.com”? A) dig @8.8.8.8 example.com A B) nslookup example.com 8.8.8. C) host - t A example.com 8.8.8. D) all of the above Answer: D Explanation: All three commands allow specifying the DNS server and request an A record. Question 33. Which signal terminates a process gracefully, allowing it to perform cleanup? A) SIGKILL (9) B) SIGTERM (15) C) SIGSTOP (19) D) SIGSEGV (11) Answer: B Explanation: SIGTERM is the default termination signal, giving the process a chance to catch it and exit cleanly. Question 34. To display a hierarchical view of running processes sorted by memory usage, which command is most suitable?

Practice Exam

A) top - o %MEM B) htop C) ps aux --sort=-%mem D) any of the above Answer: D Explanation: All listed tools can present processes sorted by memory; htop provides an interactive tree view. Question 35. Which command disables the firewalld service permanently? A) systemctl stop firewalld && systemctl disable firewalld B) systemctl mask firewalld C) firewall-cmd --set-default-zone=trusted D) Both A and B Answer: D Explanation: Stopping and disabling prevents it from starting on boot; masking also blocks any activation. Question 36. To check and repair an ext4 filesystem on /dev/sdb1 while it is unmounted, which command is appropriate? A) fsck - t ext4 /dev/sdb B) e2fsck /dev/sdb C) both A and B D) none of the above

Practice Exam

C) podman pull nginx D) both A and C Answer: D Explanation: Both Docker and Podman use pull to fetch images; specifying :latest is optional because it is the default tag. Question 40. To run a container named “web” exposing host port 8080 to container port 80, which command is correct? A) docker run - d --name web - p 8080:80 nginx B) docker start web - p 8080: C) docker exec - d web - p 8080: D) docker create - p 8080:80 web Answer: A Explanation: docker run creates and starts the container; -p host:container maps ports. Question 41. Which file is used by cloud‑init to set the hostname on first boot of a cloud VM? A) /etc/cloud/cloud.cfg.d/99_hostname.cfg B) /etc/cloud/cloud.cfg C) /var/lib/cloud/instance/boot-finished D) /etc/hostname Answer: B

Practice Exam

Explanation: cloud.cfg contains the modules; the hostname module reads the preserve_hostname and hostname keys. Question 42. In a Kubernetes deployment, which object ensures that a specified number of pod replicas are always running? A) Service B) Deployment C) ConfigMap D) Ingress Answer: B Explanation: A Deployment manages replica sets and ensures the desired replica count. Question 43. Which git command stages all modified and deleted files for the next commit? A) git add. B) git add - A C) git commit - a D) both A and B Answer: D Explanation: git add . stages new/modified files in the current directory; git add - A stages all changes including deletions. git commit - a skips the explicit add step but does not stage new files. Question 44. To view the commit history of the current branch in a compact one‑line format, which command is used?

Practice Exam

Explanation: git revert adds a new commit that reverses the effects of the given commit, preserving history. Question 47. Which of the following is a primary benefit of using Infrastructure as Code (IaC)? A) Manual configuration of each server. B) Version‑controlled, repeatable infrastructure deployments. C) Increased reliance on physical hardware. D) None of the above. Answer: B Explanation: IaC stores configuration in code, enabling version control, automation, and reproducibility. Question 48. Which Ansible module is used to ensure a package is installed on a target host? A) yum B) apt C) package D) all of the above Answer: D Explanation: yum, apt, and the generic package module can all ensure package presence, depending on the OS.

Practice Exam

Question 49. To capture the output of the command df - h on multiple remote hosts via SSH and store each result in a separate file named after the host, which one‑liner could be used? A) for h in host1 host2; do ssh $h "df - h" > ${h}_disk.txt; done B) parallel - S host1,host2 "df - h > {}_disk.txt" C) ansible all - m command - a "df - h" --output /tmp/{{ inventory_hostname }}_disk.txt D) All of the above are viable solutions. Answer: A Explanation: The simple Bash loop redirects each host’s output to a uniquely named file. Options B and C require additional tools and syntax not shown correctly. Question 50. Which command displays the current SELinux mode (enforcing, permissive, or disabled)? A) sestatus | grep "Current mode" B) getenforce C) selinuxenabled && echo "enabled" D) both A and B Answer: D Explanation: getenforce directly prints the mode; sestatus also reports it. Question 51. Which of the following files defines static routes that are applied at boot on a Red Hat‑based system? A) /etc/sysconfig/network-scripts/route‑eth B) /etc/network/interfaces C) /etc/sysconfig/network