LPI 102-500 Exam Questions
LPIC-1 Exam 102, Part 2 of 2, version 5.0 (Page 7 )

Updated On: 21-Feb-2026

You are looking into a new script you received from your senior administrator. In the very first line you notice a #! followed by a file path. This indicates that:

  1. The file at that location was used to make the script.
  2. This script provides identical functionality as the file at that location.
  3. This script will self-extract into a file at that location.
  4. The program at that location will be used to process the script.

Answer(s): D

Explanation:

The #! followed by a file path is called a shebang or a hashbang. It is a special notation that tells the operating system which interpreter to use to execute the script. For example, if the first line of a script is #!/bin/bash, it means that the script will be run by the Bash shell, which is located at /bin/bash. Similarly, if the first line of a script is #!/usr/bin/python3, it means that the script will be run by the Python 3 interpreter, which is located at /usr/bin/python3. The shebang must be the very first line of the script, and it must start with #! without any spaces. The file path after the #! must be an absolute path, not a relative path or a symbolic link. The shebang allows the script to be executed as a standalone program, without specifying the interpreter explicitly. For example, if a script named hello.sh has a shebang of #!/bin/bash, and it has the executable permission, it can be run as ./hello.sh instead of bash hello.sh. The shebang also allows the script to be associated with a specific interpreter, regardless of the default interpreter of the system or the user. For example, if a script named hello.py has a shebang of #!/usr/bin/python3, it will always be run by Python 3, even if the system or the user has Python 2 as the default Python interpreter. The shebang is not a comment, although it looks like one. It is a special instruction that is only recognized by the operating system when the script is executed. It is ignored by the interpreter when the script is read. Therefore, the shebang does not indicate that the file at that location was used to make the script, or that the script provides identical functionality as the file at that location, or that the script will self-extract into a file at that location. The correct answer is that the program at that location will be used to process the script. You can learn more about the shebang here1 and here2.



What keyword is missing from this code sample of a shell script?

____ i in *.txt; do echo $i done

  1. for
  2. loop
  3. until
  4. while

Answer(s): B

Explanation:

The set command is used to display or modify the shell variables and functions in the current shell.
When used without any arguments, it prints the names and values of all shell variables, including environment variables and user-defined variables, in alphabetical order. The output also includes the shell options and the positional parameters. The set command can be used in any POSIX-compliant shell, such as bash, zsh, ksh, etc123.
The other options are not correct because:
env is used to print or modify the environment variables, not the shell variables. It does not show the user-defined variables or the shell options. It can also be used to run a command in a modified environment45.
env -a is an invalid option for the env command. The -a option is not supported by the env command in any standard or common implementation45.
echo $ENV is used to print the value of the environment variable ENV, not the list of all shell variables. The ENV variable is usually set to the name of a file that contains commands or aliases to be executed by the shell. It is mainly used by the ksh and some versions of bash .


Reference:

1: How can I list all shell variables? - Unix & Linux Stack Exchange 2: 2.1 Command Line Basics - Linux Professional Institute Certification ... 3: set - The Open Group Base Specifications Issue 7, 2018 edition 4: How to set and list environment variables on Linux 5: env - The Open Group Base Specifications Issue 7, 2018 edition : What is the difference between .bash_profile and .bashrc? - Unix & Linux Stack Exchange : ENV - The Open Group Base Specifications Issue 7, 2018 edition



What word is missing from the following SQL statement?

__________ count(*) from tablename;

(Please specify the missing word using lower-case letters only.)

  1. select

Answer(s): A

Explanation:

The missing word is select, which is the keyword used to query data from a table in SQL. The select statement has the following syntax:
select column_list from table_name where condition;
The column_list can be one or more columns separated by commas, or an asterisk () to indicate all columns. The table_name is the name of the table that contains the dat a. The where clause is optional and specifies a condition to filter the rows. The count() function is an aggregate function that returns the number of rows in the table or in a group. Therefore, the complete statement is:
select count(*) from tablename;

This statement will return the number of rows in the table named tablename.


Reference:

SQL COUNT() Function - W3Schools, SQL COUNT: The Ultimate Guide To SQL COUNT Function - SQL Tutorial, The SQL Count Function Explained With 7 Examples.



Which file used by XDM specifies the default wallpaper?

  1. /etc/X11/xdm/Xsetup
  2. /etc/X11/xdm.conf
  3. /etc/X11/xdm/Defaults
  4. /etc/X11/defaults.conf

Answer(s): A

Explanation:

The file that specifies the default wallpaper for XDM is /etc/X11/xdm/Xsetup. XDM is a display manager for the X Window System that provides a graphical login screen and manages user sessions. The /etc/X11/xdm/Xsetup file is executed when XDM starts the X server and before any user login or session starts. This file can be used to configure the X server, set X resources, and perform any other system-wide setup tasks, such as setting the wallpaper. To set the wallpaper, one can use a command like qiv -z /usr/local/share/backgrounds/wallpaper.jpg in the /etc/X11/xdm/Xsetup file, where qiv is an image viewer and /usr/local/share/backgrounds/wallpaper.jpg is the path to the desired wallpaper image1.
The other options are not correct/etc/X11/xdm.conf is the configuration file for XDM, which specifies how XDM should behave, such as the access control, the login window, and the session types2/etc/X11/xdm/Defaults is the directory where the default XDM configuration files are stored, such as Xresources, Xsession, and Xwilling2. /etc/X11/defaults.conf is not a valid file or directory related to XDM or X Window System.


Reference:

XDM - ArchWiki
Configuring XDM - Linux Documentation Project



Which command can be used to investigate the properties for a particular window in X by clicking that window? (Specify ONLY the command without any path or parameters.)

  1. /usr/bin/xwininfo,
    Xwininfo

Answer(s): A

Explanation:

The command that can be used to investigate the properties for a particular window in X by clicking that window is xwininfo. xwininfo is a command-line tool that provides information about X windows.
When executed, it opens a small window and waits for the user to select a window by clicking on it. Then, it displays various characteristics about the window in question, such as its geometry, position, size, depth, class, name, id, and more. xwininfo is part of the X Window System, which is a graphical user interface system for Unix-like operating systems. xwininfo can be useful for debugging, testing, or scripting purposes.


Reference:

https://bing.com/search?q=command+to+investigate+properties+of+a+windo w+in+X
https://www.exam-answer.com/linux-foundation-certified-system-administrator-lfcs-simulation- investigate-window-properties






Post your Comments and Discuss LPI 102-500 exam dumps with other Community members:

Join the 102-500 Discussion