All LPI exams

Free 102-500 practice test: 30 questions with answers

30 original questions for LPIC-1 Exam 102, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.

Free questions
30
Full bank
112 questions
Real exam
60 questions, 90 min

102-500 exam guide: topics, cost and format

All 30 102-500 questions with answers

The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.

109 Networking Fundamentals (5 questions)

  1. Question 1

    A host is configured with 192.168.10.37/24. Which address is the IPv4 broadcast address for its network?

    1. A192.168.10.255
    2. B192.168.10.0
    3. C192.168.0.255
    4. D192.168.10.38
    Show answer and explanation
    Correct answer: A

    With a /24 mask the network is 192.168.10.0 and the broadcast address is the last address in that range, 192.168.10.255. 192.168.10.0 is the network address, 192.168.0.255 belongs to a different network, and 192.168.10.38 is just the next host address.

  2. Question 2

    A public web server must accept encrypted HTTPS connections from browsers on the default well-known port. Which TCP port does HTTPS use by default?

    1. A25
    2. B80
    3. C443
    4. D53
    Show answer and explanation
    Correct answer: C

    HTTPS uses TCP port 443 by default. Port 80 is the default for plain HTTP, port 25 is used for SMTP mail transfer, and port 53 is used for DNS.

  3. Question 3

    Which two statements about the TCP and UDP transport protocols are correct? (Choose two.)

    1. ATCP provides reliable, ordered delivery of a byte stream
    2. BUDP performs a three-way handshake before any data is sent
    3. CTCP is connectionless and does not use acknowledgements
    4. DUDP adds sequence numbers and retransmits lost datagrams
    5. EBoth TCP and UDP use port numbers to identify services
    Show answer and explanation
    Correct answer: A, E

    TCP guarantees ordered, reliable delivery over a connection, and both TCP and UDP use port numbers to address services. UDP has no handshake, acknowledgements or retransmission, and TCP is connection-oriented, so the other statements are wrong.

  4. Question 4

    An Ubuntu Server installation uses netplan to manage its network. Where are the YAML files that define the persistent network configuration stored?

    1. A/etc/resolv.conf
    2. B/etc/network/interfaces
    3. C/etc/sysconfig/network-scripts
    4. D/etc/netplan
    Show answer and explanation
    Correct answer: D

    netplan reads its YAML files from /etc/netplan and generates the configuration for the selected renderer. /etc/network/interfaces belongs to the ifupdown system used on Debian, /etc/sysconfig/network-scripts belongs to older Red Hat style systems, and /etc/resolv.conf holds DNS resolver settings rather than interface definitions.

  5. Question 5

    A host can reach machines on its local subnet but not hosts on remote networks. The administrator wants to check whether a default gateway is configured. Which command shows the routing table?

    1. Aip neigh show
    2. Bip link show
    3. Cip route show
    4. Dip addr show
    Show answer and explanation
    Correct answer: C

    ip route show prints the kernel routing table, including any default route through a gateway. ip link show lists the network interfaces, ip neigh show lists the neighbour (ARP) cache, and ip addr show lists the addresses assigned to interfaces.

107 Administrative Tasks (5 questions)

  1. Question 6

    An administrator must add the existing user alice to the supplementary group developers, and alice must keep her current group memberships. Which command does this?

    1. Auseradd -G developers alice
    2. Busermod -G developers alice
    3. Cgroupmod -a developers alice
    4. Dusermod -aG developers alice
    Show answer and explanation
    Correct answer: D

    usermod -aG appends the group to the supplementary list without removing existing memberships. Using -G alone replaces the whole list, groupmod has no option for adding members, and useradd cannot modify an account that already exists.

  2. Question 7

    Which two files on a typical Linux system store user or group account information? (Choose two.)

    1. A/etc/passwd
    2. B/etc/fstab
    3. C/etc/group
    4. D/etc/hostname
    Show answer and explanation
    Correct answer: A, C

    /etc/passwd holds the user account entries and /etc/group holds group definitions and their members. /etc/fstab lists the filesystems to mount and /etc/hostname stores the system's host name, so neither describes accounts.

  3. Question 8

    A report script must run at 06:30 every Monday through Friday. Which crontab entry achieves this?

    1. A30 6 1-5 * * /usr/local/bin/report.sh
    2. B6 30 * * 1-5 /usr/local/bin/report.sh
    3. C30 6 * * 0-6 /usr/local/bin/report.sh
    4. D30 6 * * 1-5 /usr/local/bin/report.sh
    Show answer and explanation
    Correct answer: D

    The crontab fields are minute, hour, day of month, month and day of week, so 30 6 * * 1-5 runs at 06:30 from Monday to Friday. Swapping minute and hour gives an invalid hour, 0-6 in the weekday field means every day, and 1-5 in the day-of-month field restricts dates instead of weekdays.

  4. Question 9

    An administrator needs a one-time cleanup script to run at 23:00 tonight and never again. Which scheduling tool is designed for this?

    1. Acrontab -e entry
    2. Bat command
    3. Canacron jobs
    4. Dbatch command
    Show answer and explanation
    Correct answer: B

    The at command queues a single job to run at a specified time and then removes it. crontab -e edits recurring cron entries, anacron runs periodic jobs on machines that are not always powered on, and batch runs jobs when the system load drops rather than at a set time.

  5. Question 10

    A user's session sets LANG=en_US.UTF-8, so menus appear in English. The user wants dates and times to follow German conventions while everything else stays unchanged. Which setting achieves this?

    1. ALC_ALL=de_DE.UTF-8
    2. BLC_TIME=de_DE.UTF-8
    3. CLC_MESSAGES=de_DE.UTF-8
    4. DLANGUAGE=de_DE
    Show answer and explanation
    Correct answer: B

    LC_TIME controls only the date and time format category, so it changes dates while LANG keeps the other categories. LC_ALL overrides every category including messages, LC_MESSAGES changes only program message text, and LANGUAGE selects translations of messages rather than date formats.

108 Essential System Services (5 questions)

  1. Question 11

    A Linux server's clock drifts by several seconds each week. The administrator wants the system clock to keep synchronising automatically with network time servers. Which service does this?

    1. Achronyd daemon
    2. Bcron daemon
    3. Csyslogd daemon
    4. Dlogrotate utility
    Show answer and explanation
    Correct answer: A

    chronyd is a daemon that keeps the system clock synchronised with NTP servers. The cron daemon runs scheduled jobs, syslogd records log messages, and logrotate rotates log files, so none of them adjusts the clock.

  2. Question 12

    On a systemd-based host, an administrator wants to see only the journal entries that belong to the sshd unit. Which command shows them?

    1. Acat /var/log/sshd.conf
    2. Blogrotate -f sshd
    3. Cjournalctl -u sshd
    4. Dls -l /var/log/journal
    Show answer and explanation
    Correct answer: C

    journalctl -u filters the journal by unit name, so journalctl -u sshd shows only sshd's entries. logrotate forces log rotation, cat would print a configuration file rather than the journal, and ls -l only lists the journal directory.

  3. Question 13

    A syslog message reports that the system is unusable. Under the standard syslog priority levels, which level should the message carry?

    1. Aerr
    2. Bcrit
    3. Calert
    4. Demerg
    Show answer and explanation
    Correct answer: D

    emerg is the highest syslog priority and is reserved for a system that is unusable. alert means immediate action is needed while the system still works, crit marks critical conditions, and err marks ordinary errors.

  4. Question 14

    A cron job on a Linux server sends its output to the local user root. The administrator wants that mail forwarded to the team mailbox. Which file is edited for this mail alias, followed by running newaliases?

    1. A/etc/aliases
    2. B/etc/hosts
    3. C/etc/services
    4. D/etc/resolv.conf
    Show answer and explanation
    Correct answer: A

    /etc/aliases maps local mail recipients to other addresses, and newaliases rebuilds the alias database that the mail transfer agent reads. /etc/hosts maps host names to addresses, /etc/services lists port names, and /etc/resolv.conf configures DNS resolver settings, so none of them handles mail aliasing.

  5. Question 15

    An administrator opens http://localhost:631 in a browser to add a network printer and manage print queues. Which printing system provides this web interface?

    1. ACUPS printing
    2. BSANE scanning
    3. CALSA audio
    4. DPulseAudio sound
    Show answer and explanation
    Correct answer: A

    CUPS, the Common UNIX Printing System, serves its administration interface on port 631. SANE is the scanner framework, ALSA is the kernel sound architecture, and PulseAudio is a sound server, so none of them manages print queues.

110 Security (5 questions)

  1. Question 16

    An auditor needs a list of all files on the system that have the setuid bit set. Which find command produces this list?

    1. Afind / -user root
    2. Bfind / -perm 0777
    3. Cfind / -perm -4000
    4. Dfind / -name setuid
    Show answer and explanation
    Correct answer: C

    -perm -4000 matches files in which the setuid bit is set, regardless of the other permission bits. -perm 0777 matches only files with exactly mode 777, -user root selects files by owner, and -name setuid matches only files whose name is setuid.

  2. Question 17

    An administrator wants to give one user permission to run only systemctl restart nginx with sudo. Which tool should be used to edit the sudoers configuration because it checks the syntax before saving?

    1. Apasswd
    2. Bvisudo
    3. Cchage
    4. Dusermod
    Show answer and explanation
    Correct answer: B

    visudo locks /etc/sudoers, lets the administrator edit it and checks the syntax before saving, which prevents a broken file from disabling sudo. passwd changes passwords, chage manages password aging, and usermod changes account attributes, so none of them edits sudo rules.

  3. Question 18

    A security review asks for a list of past successful logins on a host, showing the user, the terminal and the time. Which command displays this history?

    1. Alast
    2. Buptime
    3. Chistory
    4. Dps aux
    Show answer and explanation
    Correct answer: A

    last reads the login records in /var/log/wtmp and shows past sessions with the user, terminal and time. uptime reports how long the system has been running, history lists the current user's shell commands, and ps aux lists running processes.

  4. Question 19

    A colleague must send an encrypted file to a recipient who has published an OpenPGP key. The sender wants only that recipient to be able to decrypt the file. Which key is used to encrypt it?

    1. AThe recipient's private key
    2. BThe sender's private key
    3. CThe recipient's public key
    4. DA shared symmetric passphrase only
    Show answer and explanation
    Correct answer: C

    Public-key encryption uses the recipient's public key, and only the matching private key held by the recipient can decrypt the file. The sender's private key is used for signing, the recipient's private key is held only by the recipient and is needed for decryption, and a shared passphrase gives symmetric encryption rather than public-key encryption.

  5. Question 20

    Security policy forbids direct root logins over SSH, but administrators still log in with passwords through their own accounts. Which sshd_config setting enforces the policy?

    1. APasswordAuthentication no
    2. BPort 2222
    3. CPermitRootLogin no
    4. DX11Forwarding yes
    Show answer and explanation
    Correct answer: C

    PermitRootLogin no stops the root account from logging in through sshd, while other accounts keep working. PasswordAuthentication no would disable passwords for every account, Port 2222 only changes the listening port, and X11Forwarding yes enables graphical forwarding, so none of them restricts root.

105 Shells and Shell Scripting (5 questions)

  1. Question 21

    A user opens a new terminal window inside a graphical desktop session on a typical Linux distribution. The shell started is an interactive bash shell that is not a login shell. Which startup file does bash read for this kind of shell?

    1. A~/.bash_logout
    2. B~/.bashrc
    3. C~/.bash_history
    4. D~/.inputrc
    Show answer and explanation
    Correct answer: B

    Bash reads ~/.bashrc for interactive non-login shells such as a new terminal window, which is why aliases and prompt settings placed there appear in those windows. ~/.bash_logout runs when a login shell exits, ~/.bash_history only stores past commands, and ~/.inputrc configures readline key bindings rather than the shell startup.

  2. Question 22

    A script starts with #!/bin/sh but uses bash-only features such as indexed arrays and the [[ ... ]] test syntax. The script is run on a system where /bin/sh is linked to dash. What is the most likely result?

    1. AThe shell reports syntax errors at the bash-only constructs
    2. BThe script runs without errors because dash supports all bash syntax
    3. CThe kernel ignores the shebang and runs the script with bash
    4. DThe script runs inside the user's login shell instead
    Show answer and explanation
    Correct answer: A

    The shebang selects the interpreter, so dash parses the file and rejects bash-only arrays and [[ ]] with syntax errors. Dash does not implement bash extensions, the kernel uses the shebang interpreter rather than substituting bash, and scripts are not run in the login shell.

  3. Question 23

    A script named backup.sh in the current directory fails with 'Permission denied' when run as ./backup.sh. The user running the command owns the file. Which single command most directly fixes the problem?

    1. Achown $USER backup.sh
    2. Bchmod u+x backup.sh
    3. Cchmod -R 777 /
    4. Dexport PATH=$PWD:$PATH
    Show answer and explanation
    Correct answer: B

    The 'Permission denied' error means the execute bit is missing, and chmod u+x adds it for the owner. chown only changes ownership, recursive 777 on / is an unrelated and dangerous change, and editing PATH has no effect when the script is started with ./ .

  4. Question 24

    Which two statements about shell variables and environment variables are correct? (Choose two.)

    1. AA variable marked with export is inherited by child processes started from that shell
    2. BA shell variable that is not exported is automatically visible to every child process
    3. CPositional parameters such as $1 persist as environment variables after the script exits
    4. DA child process can change the value of a variable in its parent shell
    5. EA child process receives a copy of the environment when it starts, so later changes made in the parent are not seen by it
    Show answer and explanation
    Correct answer: A, E

    Exporting a variable places it in the environment that child processes inherit, and each child receives a copy made when it starts. Unexported shell variables stay local to the shell, positional parameters exist only during the script invocation, and a child process cannot modify its parent's variables.

  5. Question 25

    A script must store the output of a command in a variable, and the syntax chosen should be able to nest cleanly inside other commands. Which construct does this?

    1. A${command}
    2. B%{command}
    3. C$[command]
    4. D$(command)
    Show answer and explanation
    Correct answer: D

    $(command) runs the command in a subshell and substitutes its output, and it nests without any escaping. ${command} is parameter expansion, $[command] is an obsolete arithmetic form, and %{command} is not valid shell syntax.

106 User Interfaces and Desktops (5 questions)

  1. Question 26

    On a traditional X11 desktop, a user reports that no application windows are drawn on the screen and that keyboard and mouse input reaches no program. Which component is responsible for these tasks?

    1. AThe desktop environment
    2. BThe window manager
    3. CThe display manager
    4. DThe X server
    Show answer and explanation
    Correct answer: D

    The X server is the display server that controls the screen and routes input events to client applications. The window manager arranges and decorates windows, the display manager presents the login screen, and the desktop environment is a bundle of panels and applications built on top of X.

  2. Question 27

    A visually impaired user on a GNOME desktop needs the interface read aloud, including focus changes and text inside applications. Which assistive technology should be enabled for this?

    1. Axinput device setup
    2. Bxrandr monitor setup
    3. COrca screen reader
    4. Dxmodmap keymap editor
    Show answer and explanation
    Correct answer: C

    Orca is the screen reader used with GNOME to speak interface elements and focus changes. The other options are X11 command-line tools: xrandr configures monitor resolution and layout, xinput manages input devices, and xmodmap changes the keyboard mapping, and none of them provides speech output.

  3. Question 28

    A Linux system boots and presents a graphical login screen before the user's session starts. Which component presents this login screen and starts the session?

    1. AX server
    2. BWindow manager
    3. CDesktop environment
    4. DDisplay manager
    Show answer and explanation
    Correct answer: D

    The display manager, such as GDM, LightDM or SDDM, shows the graphical login prompt and starts the user's session. The X server provides the display, a window manager controls window placement, and a desktop environment supplies panels and applications after login.

  4. Question 29

    A user connects by SSH with X forwarding and starts a graphical program. Which environment variable tells the program which X display to use?

    1. ATERM variable
    2. BPATH variable
    3. CLANG variable
    4. DDISPLAY variable
    Show answer and explanation
    Correct answer: D

    DISPLAY names the X server and screen a client should draw on, such as localhost:10.0 when forwarding is used. TERM describes the terminal type, PATH lists command directories, and LANG selects the locale, so none of them selects the X display.

  5. Question 30

    A user starts a graphical session with startx from a text console, without any display manager. Which file in the home directory lists the programs that startx launches?

    1. A~/.Xresources
    2. B~/.xinitrc
    3. C~/.Xauthority
    4. D~/.xsession-errors
    Show answer and explanation
    Correct answer: B

    ~/.xinitrc is read by startx and xinit and lists the programs to launch, such as the window manager. ~/.Xresources holds application resource settings, ~/.Xauthority stores X authorization cookies, and ~/.xsession-errors collects error output from the session.