Docsity

LFCE Linux Foundation Certified Engineer Practice Exam, Exams of Technology

Toggle sidebar
bg1
LFCE Linux Foundation Certified Engineer
Practice Exam
Question 1. **Which Git command records changes to the repository without committing
them?**
A) git push
B) git stash
C) git commit --amend
D) git revert
Answer: B
Explanation: `git stash` saves local modifications away temporarily, allowing you to work on a
clean tree without committing.
Question 2. **In a Bash script, which construct correctly iterates over lines of a file stored in
variable $FILE?**
A) for line in $FILE; do … done
B) while read -r line; do … done < "$FILE"
C) foreach line in $FILE; do … endforeach
D) repeat line in $FILE; do … repeat
Answer: B
Explanation: `while read -r line; do … done < "$FILE"` reads each line safely, preserving
whitespace.
Question 3. **Which `sed` option enables in‑place editing of a file?**
A) -e
B) -n
C) -i
D) -s
Answer: C
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 LFCE Linux Foundation Certified Engineer Practice Exam and more Exams Technology in PDF only on Docsity!

Practice Exam

Question 1. Which Git command records changes to the repository without committing them? A) git push B) git stash C) git commit --amend D) git revert Answer: B Explanation: git stash saves local modifications away temporarily, allowing you to work on a clean tree without committing. Question 2. In a Bash script, which construct correctly iterates over lines of a file stored in variable $FILE? A) for line in $FILE; do … done B) while read - r line; do … done < "$FILE" C) foreach line in $FILE; do … endforeach D) repeat line in $FILE; do … repeat Answer: B Explanation: while read - r line; do … done < "$FILE" reads each line safely, preserving whitespace. Question 3. Which sed option enables in‑place editing of a file? A) - e B) - n C) - i D) - s Answer: C

Practice Exam

Explanation: The -i flag tells sed to edit the file directly, creating a backup if a suffix is supplied. Question 4. What does the awk program {print $NF} output for each input line? A) The first field B) The last field C) The number of fields D) The entire line Answer: B Explanation: $NF is a built‑in variable representing the number of fields; print $NF prints the last field. Question 5. Which tool can simultaneously execute a command on 50 remote hosts over SSH without writing a custom loop? A) scp B) rsync C) pdsh D) tar Answer: C Explanation: pdsh (parallel distributed shell) runs a command on many hosts concurrently. Question 6. During a manual installation of CentOS Stream, which boot option allows you to start the installer in text mode? A) linux text B) inst.text C) mode=text

Practice Exam

C) --skip-gpg D) --no‑verify Answer: A Explanation: --nogpgcheck tells yum not to verify the package’s GPG signature. Question 10. Which file contains the list of enabled repositories for DNF on Fedora? A) /etc/dnf/dnf.conf B) /etc/yum.repos.d/.repo C) /etc/dnf/repos.d/.repo D) /etc/dnf.conf.d/*.repo Answer: C Explanation: DNF reads repository definitions from /etc/dnf/repos.d/. Question 11. To apply a runtime kernel parameter without rebooting, which command is used? A) sysctl - p /etc/sysctl.conf B) sysctl - w vm.swappiness= C) echo 10 > /proc/sys/vm/swappiness D) All of the above Answer: D Explanation: All three methods set a kernel parameter at runtime; sysctl - p reads a file, -w writes a value, and writing to /proc/sys directly works as well. Question 12. Which Ansible module is used to manage SELinux booleans? A) seboolean B) selinux

Practice Exam

C) sefcontext D) firewalld Answer: B Explanation: The selinux module can enable/disable SELinux booleans and set the state of SELinux. Question 13. In a systemd service unit, which directive defines the command to start the service? A) ExecStartPre= B) ExecStart= C) ExecReload= D) ExecStop= Answer: B Explanation: ExecStart= specifies the main process to launch when the unit starts. Question 14. Which command creates a snapshot of an LVM logical volume named lv_data? A) lvcreate - s - n snap_lv - L 1G /dev/vg0/lv_data B) lvcreate - n snap_lv - L 1G /dev/vg0/lv_data C) lvconvert --snapshot /dev/vg0/lv_data D) lvsnap /dev/vg0/lv_data snap_lv Answer: A Explanation: lvcreate - s creates a snapshot; -n gives the snapshot name and -L its size. Question 15. Which udev rule matches USB storage devices and runs a script /usr/local/bin/usb‑notify.sh?

Practice Exam

Question 18. Which ip command creates a GRE tunnel interface named gre0 with remote endpoint 192.0.2.10? A) ip tunnel add gre0 mode gre remote 192.0.2.10 local $(hostname - I) ttl 255 B) ip link add gre0 type gre remote 192.0.2. C) ip tunnel add gre0 mode gre remote 192.0.2.10 local 0.0.0. D) ip gre add gre0 remote 192.0.2. Answer: A Explanation: ip tunnel add with mode gre defines the tunnel; you must also specify the local address (often obtained via hostname - I). Question 19. Which iptables target is used to allow packets that belong to an established connection? A) ACCEPT B) DROP C) REJECT D) ESTABLISHED Answer: A (with state match) Explanation: The rule -m conntrack --ctstate ESTABLISHED,RELATED - j ACCEPT uses the ACCEPT target; the state match identifies established traffic. Question 20. In firewalld, which command adds a permanent TCP service “http” to the public zone? A) firewall-cmd --zone=public --add-service=http --permanent B) firewall-cmd --add-service=http --zone=public C) firewall-cmd --permanent --add-service=http --zone=public D) firewall-cmd --zone=public --add-port=80/tcp --permanent

Practice Exam

Answer: A Explanation: --add-service adds the predefined “http” service; --permanent writes it to the configuration. Question 21. Which directive in an Apache virtual host enables HTTP/2? A) Protocols h2 http/1. B) LoadModule http2_module modules/mod_http2.so C) H2Push on D) All of the above (when combined) Answer: D Explanation: Enabling HTTP/2 requires loading the module, adding Protocols h2 http/1.1, and optionally configuring H2 directives. Question 22. When configuring Nginx as a reverse proxy, which directive forwards the original client IP address? A) proxy_set_header X-Real-IP $remote_addr; B) proxy_pass_header X-Forwarded-For; C) proxy_forwarded_for on; D) client_real_ip on; Answer: A Explanation: proxy_set_header X-Real-IP $remote_addr; adds the client’s IP to the request headers. Question 23. Which command initializes a new Chrony tracking server with a stratum of 1? A) chronyc makestep 1 3 B) chronyd - q "master stratum 1"

Practice Exam

B) header_checks C) smtpd_recipient_restrictions D) access_maps Answer: A Explanation: smtpd_sender_restrictions can reference a hash map (created from blacklist) to reject senders. Question 27. Which Squid directive limits the maximum size of a cached object to 10 MB? A) maximum_object_size 10 MB B) cache_max_size 10 MB C) max_object_size 10 MB D) object_size_limit 10 MB Answer: A Explanation: maximum_object_size sets the upper bound for objects stored in the cache. Question 28. In an LDAP directory, which attribute uniquely identifies an entry across the entire tree? A) cn B) uid C) entryUUID D) sn Answer: C Explanation: entryUUID is a universally unique identifier assigned by the server. Question 29. Which PXE boot file is typically requested by a BIOS‑based client using the iPXE protocol?

Practice Exam

A) boot.ipxe B) undionly.kpxe C) ipxe.lkrn D) pxelinux. Answer: B Explanation: BIOS clients commonly download undionly.kpxe as the first-stage iPXE binary. Question 30. When configuring BIND as an authoritative server, which statement defines a secondary zone? A) zone "example.com" { type master; file "db.example.com"; }; B) zone "example.com" { type slave; masters { 192.168.1.10; }; file "slaves/db.example.com"; }; C) zone "example.com" { type stub; masters { 192.168.1.10; }; }; D) zone "example.com" { type forward; forwarders { 8.8.8.8; }; }; Answer: B Explanation: type slave (or slave) denotes a secondary zone that pulls data from the master. Question 31. Which LVM command expands a logical volume named lv_home by 5 GB? A) lvextend - L +5G /dev/vg0/lv_home B) lvresize - L +5G /dev/vg0/lv_home C) lvextend - l +5%VG /dev/vg0/lv_home D) lvaddsize +5G /dev/vg0/lv_home Answer: A Explanation: lvextend - L +5G adds 5 GB to the LV; afterwards the filesystem must be resized. Question 32. Which blkid option prints only the UUID of /dev/sda1?

Practice Exam

Question 35. To create an iSCSI target using targetcli, which command defines a backstore for a 10 GB file? A) /backstores/fileio create iqn.2024-01.com.example:disk1 /var/lib/iscsi_disks/disk1.img 10G B) /backstores/fileio create disk1 /var/lib/iscsi_disks/disk1.img 10G C) /backstores/block create disk1 /dev/loop0 10G D) /iscsi create iqn.2024-01.com.example:disk Answer: B Explanation: In targetcli, /backstores/fileio create <name> <path> <size> defines a file‑backed LUN. Question 36. Which NFS export option forces all client mounts to be read‑only? A) ro B) rw C) sync D) no_root_squash Answer: A Explanation: ro (read‑only) makes the export immutable for clients. Question 37. When configuring Samba, which parameter in smb.conf defines the workgroup name? A) netbios name = WORKGROUP B) workgroup = WORKGROUP C) server string = WORKGROUP D) domain = WORKGROUP Answer: B Explanation: The workgroup directive sets the SMB workgroup.

Practice Exam

Question 38. Which command lists all running containers managed by LXC? A) lxc-ls --active B) lxc-info --list C) lxc list --running D) lxc-top Answer: C Explanation: lxc list --running shows containers whose state is RUNNING. Question 39. In libvirt, which XML element defines the amount of memory allocated to a virtual machine? A) B) 1024 C) 1024 D) memory Answer: B Explanation: The <memory> element (with unit attribute) sets the VM’s RAM. Question 40. Which Pacemaker resource agent is used to manage a virtual IP address? A) ocf:heartbeat:IPaddr B) ocf:heartbeat:VirtualIP C) ocf:heartbeat:IPaddr D) ocf:heartbeat:IPaddr_managed Answer: A Explanation: IPaddr2 is the standard RA for floating IPs.

Practice Exam

Answer: A Explanation: --memory=512m sets the maximum RAM the container can allocate. Question 44. Which systemd target is equivalent to the traditional runlevel 3 (multi‑user, no GUI)? A) graphical.target B) multi-user.target C) runlevel3.target D) rescue.target Answer: B Explanation: multi-user.target provides a non‑graphical multi‑user environment. Question 45. When using perf top, what does the % column represent? A) Percentage of total CPU cycles spent in the function B) Percentage of total memory used C) Percentage of I/O wait time D) Percentage of network bandwidth Answer: A Explanation: perf top shows the proportion of sampled CPU cycles attributed to each symbol. Question 46. Which command adds a new A record for www.example.com pointing to 203.0.113.10 in a BIND zone file? A) www IN A 203.0.113. B) www.example.com. A 203.0.113. C) www.example.com A 203.0.113. D) www.example.com. IN A 203.0.113.

Practice Exam

Answer: D Explanation: The full FQDN followed by IN A is the correct syntax. Question 47. In SELinux, which command temporarily sets the mode to permissive for the current session? A) setenforce 0 B) semanage permissive - a all C) selinuxenabled 0 D) restorecon - R / Answer: A Explanation: setenforce 0 switches SELinux to permissive until reboot. Question 48. Which nmcli command creates a new bridge interface named br0? A) nmcli connection add type bridge ifname br B) nmcli device add bridge br C) nmcli bridge add name br D) nmcli connection add type ethernet ifname br0 master br Answer: A Explanation: nmcli connection add type bridge ifname br0 creates the bridge. Question 49. When configuring OpenSSH to require public‑key authentication only, which line must be present in sshd_config? A) PubkeyAuthentication yes B) PasswordAuthentication no C) AuthenticationMethods publickey D) All of the above (combined)

Practice Exam

C) address D) srcmac Answer: A Explanation: -m mac --mac-source <addr> matches the source MAC. Question 53. When using rsync over SSH to copy /var/www to a remote host while preserving permissions, which options are required? A) - a - e ssh B) - r - p - e ssh C) - avz - e ssh D) - t - l - e ssh Answer: A Explanation: -a (archive) includes recursion, permissions, timestamps, etc.; -e ssh specifies the transport. Question 54. Which command displays the current SELinux context of the file /etc/passwd? A) ls - Z /etc/passwd B) getenforce /etc/passwd C) seinfo /etc/passwd D) cat /proc/self/attr/current Answer: A Explanation: ls - Z prints the SELinux security context. Question 55. In a systemd‑based system, which command shows the list of enabled timers?

Practice Exam

A) systemctl list-timers --state=enabled B) systemctl list-units --type=timer --all C) timerctl list --enabled D) systemctl list-timers --all | grep enabled Answer: B Explanation: systemctl list-units --type=timer --all lists all timer units and their enablement status. Question 56. Which kernel parameter controls the maximum size of a single TCP receive window? A) net.ipv4.tcp_rmem B) net.core.rmem_max C) net.ipv4.tcp_window_scaling D) net.ipv4.tcp_mem Answer: B Explanation: net.core.rmem_max sets the upper bound for socket receive buffers, influencing TCP window size. Question 57. When configuring DHCP failover, which option defines the partner server’s address? A) failover peer 192.168.1.2; B) failover peer "dhcp-failover" { primary 192.168.1.1; secondary 192.168.1.2; }; C) secondary 192.168.1.2; D) failover address 192.168.1.2; Answer: B Explanation: The failover peer block specifies primary and secondary servers for DHCP failover.