Limited-Time Offer: Enjoy 50% Savings! Ends in 00h 00m 00s Coupon code: 50OFF
Skip to content

Free LPI LPIC-1 System Administrator Exam 102, Part 2 of 2, (version 5.0) 102-500 Exam Questions

Page: 1 / 16 Total 234 questions

Want more questions? Get Premium Access.

Question 1

What is Irue aboul Network Manager on a Linux syslem that uses its distribution's mechanisms lo configure network interfaces? (Choose TWO correct answers.)

Correct Answer: B. NetworkManager musl be explicitly enabled for each interface it should manage.; C. NetworkManager by default does not change interfaces which are already configured.

Question 2

Which command can be used to delete a group from a Linux system?

Correct Answer: A. groupdel
Explanation:

The groupdel command is used to delete a group from a Linux system. It removes the group name from the /etc/group and /etc/gshadow files, but not the group's configuration files, entries, or account files. The groupdel command requires root or sudo privileges and does not accept any options except for one for chroot. The groupdel command does not print any output on success, but it will display an error message if the group does not exist or if it is the primary group of an existing user. The groupdel command is part of the shadow-utils package, which provides tools for managing user and group accounts.The groupdel command is also compatible with the Linux Standard Base (LSB) specification, which defines a common set of commands and utilities for Linux distributions.Reference:1234


Question 3

What is the purpose of the iconv command?

Correct Answer: E. It converts files from one character encoding to another.
Explanation:

The iconv command is used to convert the encoding of a file from one character set to another. A character set is a collection of characters that are assigned numerical values called code points. Different character sets may use different numbers of bytes to represent each character, and may have different mappings of code points to characters. For example, ASCII is a single-byte character set that encodes 128 characters, while UTF-8 is a variable-length character set that can encode over a million characters. The iconv command can convert between many different character sets, such as ASCII, UTF-8, ISO-8859-1, etc. The basic syntax for using the command is as follows:

iconv [options] -f from-encoding -t to-encoding input-file > output-file

The -f option specifies the encoding of the input file, and the -t option specifies the encoding of the output file. The input file is read from standard input, and the output file is written to standard output, unless specified otherwise.The iconv command can also list all the supported character sets with the -l option1234.Reference:

How To Use the iconv Command on Linux - How-To Geek

iconv command in Linux with Examples - GeeksforGeeks

iconv - convert file encoding from one character set to another | Linux ...

Using iconv to change character encodings - FileFormat.Info


Question 4

What command is used to add OpenSSH private keys to a running ssh-agen . instance? (Specify the command name only without any path.)

Correct Answer: A. sshadd

Question 5

What is the difference between the commands test -e path and test -f path?

Correct Answer: C. Both options check the existence of the path. The -f option also confirms that it is a regular file.
Explanation:

The test command is used to perform checks and comparisons on files and values. The -e option tests if a given path exists, regardless of its type (file, directory, link, etc.). The -f option tests if a given path exists and is a regular file, not a directory or a special file. For example, if we have a directory named dir and a file named file, we can use the test command as follows:

test -e dir && echo ''dir exists'' dir exists test -f dir && echo ''dir is a regular file'' (no output) test -e file && echo ''file exists'' file exists test -f file && echo ''file is a regular file'' file is a regular file


https://www.computerhope.com/unix/bash/test.htm

Question 6

You need to pause the CUPS printer HPLaserjet4, and you want to cancel all print jobs with a message, "hello". Which command will do this?

Correct Answer: C. cupsdisable -c -r hello HPLaserjet4
Explanation:

The command cupsdisable -c -r hello HPLaserjet4 will pause the CUPS printer HPLaserjet4 and cancel all print jobs with a message, ''hello''. The cupsdisable command is used to stop printers and classes, while the cupsenable command is used to start them. The -c option cancels all jobs on the named destination, and the -r option sets the message associated with the stopped state. The message will be displayed to the users who try to print to the paused printer. For example, the output of lpstat -p HPLaserjet4 after running the command will show:

printer HPLaserjet4 disabled since Wed 23 Jun 2023 11:54:03 AM UTC -

hello

The other options are not correct. The cupsreject command is used to reject or accept jobs for a printer or class, not to pause or resume them. The -p and -m options are not valid for either cupsdisable or cupsreject. The correct syntax for cupsreject is:

cupsreject [ -E ] [ -U username ] [ -h server [:port] ] [ -r reason ] destination (s)

The -E option forces encryption of the connection to the server, the -U option uses the specified username when connecting to the server, the -h option uses the specified server and port, and the -r option sets the message associated with the rejecting state123.Reference:1: cupsdisable(8) - Linux manual page2: cupsreject(8) - Linux manual page3: CUPS Administration - Page: 1.4 - Seite 3 Raspberry Pi Geek


Question 7

What is the purpose of the Sticky Keys feature in X?

Correct Answer: A. To assist users who have difficulty holding down multiple keys at once
Explanation:

The Sticky Keys feature in X is an accessibility option that allows users to press modifier keys (such as Ctrl, Alt, Shift, or the Windows key) one at a time, instead of holding them down simultaneously, to perform keyboard shortcuts. For example, to copy something, a user can press Ctrl, release it, and then press C, instead of pressing Ctrl+C together.This can be helpful for users who have difficulty pressing multiple keys at once, or who prefer not to do so.Reference: https://www.howtogeek.com/739764/how-to-turn-off-sticky-keys-on-windows-10/

https://geekflare.com/using-sticky-keys-in-windows/


Question 8

Which of the following commands shows the current color depth of the X Server?

Correct Answer: C. xwininfo
Explanation:

The command that can be used to show the current color depth of the X Server isxwininfo. 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. The depth value indicates the number of bits per pixel used to represent the colors of the window. 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.

The other options are incorrect because they are either invalid commands or do not show the color depth of the X Server:

xcd is not a valid command in Linux. It may be confused with cd, which is used to change the current working directory.

xcdepth is not a valid command in Linux. It may be confused with xrandr, which is used to change the screen resolution and orientation.

xcolordepth is not a valid command in Linux. It may be confused with xcalib, which is used to load, alter, and query the color profile of the X display.

cat /etc/X11 is not a command, but a directory. cat is used to concatenate files and print them to the standard output. /etc/X11 is a directory that contains configuration files for the X Window System. However, these files do not necessarily show the current color depth of the X Server, as it may be overridden by other settings or options.Reference:

https://bing.com/search?q=command+to+show+color+depth+of+X+Server

https://x.org/releases/X11R7.5/doc/man/man5/xorg.conf.5.html


Question 9

A user was not given permission to use the CRON scheduling system. What file needs to be modified to provide that access? (Please specify the full path to the file)

Correct Answer: A. etccronallow
Explanation:

The/etc/cron.d/cron.allowfile is a text file that contains the names of the users who are allowed to use thecrontabcommand to create and manage their own cron jobs12.If this file exists, only the users listed in it can use thecrontabcommand, and all other users are denied access12.If this file does not exist, the/etc/cron.d/cron.denyfile is checked to see which users are not allowed to use thecrontabcommand12.If neither file exists, only the root user can use thecrontabcommand12.

To modify the/etc/cron.d/cron.allowfile, the root user can use any text editor to add or remove the names of the users who will be allowed to use thecrontabcommand1234.For example, to allow the userfrankto use thecrontabcommand, the root user can append the namefrankto the/etc/cron.d/cron.allowfile1234.The root user must always be included in this file, otherwise the superuser access to thecrontabcommand will be denied4.


Question 10

What output will the following command sequence produce?

echo '1 2 3 4 5 6' | while read a b c; do

echo result: $c $b $a;

done

Correct Answer: E. result: 3 2 1
Explanation:

The while loop reads a line from the standard input and splits it into words using the IFS variable, which by default contains spaces, tabs, and newlines. The read command assigns the first word to the variable a, the second word to the variable b, and the rest of the line to the variable c. Therefore, in this case, a=1, b=2, and c=3 4 5 6. The echo command prints the values of c, b, and a in reverse order, separated by spaces. The output is result: 3 2 1. The loop terminates after reading the first line, since there is no more input to read.Reference:Bash while Loop | Linuxize,Bash Scripting - While Loop - GeeksforGeeks


Question 11

Which of the following protocols is designed to access the video card output of a virtual machine?

Correct Answer: D. SPICE

Question 12

Which of the following files assigns a user to its primary group?

Correct Answer: D. /etc/passwd
Explanation:

The /etc/passwd file assigns a user to its primary group by specifying the group ID (GID) of the primary group in the fourth field of each line. The /etc/passwd file contains the basic information for each user account on a Linux system, such as the user name, user ID (UID), group ID (GID), home directory, login shell, etc. The format of each line is:

username:password:UID:GID:comment:home:shell

For example, the following line assigns the user bob to the primary group bob, which has the GID of 1001:

bob:x:1001:1001::/home/bob:/bin/sh

The /etc/passwd file can be viewed and modified by the root user or by using the useradd, usermod, or userdel commands123. The other files listed in the options do not assign a user to its primary group. The /etc/pgroup file does not exist by default on most Linux systems, and it is not related to the primary group.The /etc/shadow file contains the encrypted passwords and other information for each user account, but not the primary group4.The /etc/group file contains the information for each group on the system, such as the group name, group password, group ID, and group members, but not the primary group of each user5.The /etc/gshadow file contains the encrypted passwords for group accounts.Reference:12345


Question 13

Which of the following SQL queries counts the number of occurrences for each value of the field order_type in the table orders?

Correct Answer: B. SELECT order_type,COUNT(*) FROM orders GROUP BY order_type;
Explanation:

The correct SQL query to count the number of occurrences for each value of the field order_type in the table orders is:

SELECT order_type,COUNT(*) FROM orders GROUP BY order_type;

This query uses theSELECTstatement to retrieve the values of the order_type field and theCOUNT(*)function to count the number of rows for each order_type. TheGROUP BYclause groups the rows by the order_type field, so that the count is calculated for each distinct value of order_type. The result of this query is a table with two columns: order_type and count, where each row shows the number of orders for a specific order_type.

The other options are incorrect for the following reasons:

A: This query uses aWHEREclause that is always true, since order_type=order_type for every row. Therefore, this query returns the same result asSELECT order_type,COUNT(*) FROM orders;, which is a table with one row that shows the total number of orders, regardless of the order_type.

C: This query is syntactically invalid, since theCOUNTfunction cannot take a subquery as an argument. The correct way to use a subquery withCOUNTisCOUNT((SELECT order_type FROM orders));, which returns the total number of orders, regardless of the order_type.

D: This query uses theORDER BYclause to sort the rows by the order_type field, but it does not group them by order_type. Therefore, this query returns the same result asSELECT COUNT(*) FROM orders;, which is a table with one row that shows the total number of orders, regardless of the order_type.

E: This query is syntactically invalid, since there is no such function asAUTO_COUNTin SQL, and theCOUNTfunction cannot take a field name as an argument. The correct way to useCOUNTwith a field name isCOUNT(order_type);, which returns the number of non-null values in the order_type field.


[SQL COUNT Function]

[SQL GROUP BY Statement]

[SQL SELECT Statement]

Question 14

Which of the following commands lists all defined variables and functions within Bash?

Correct Answer: B. set
Explanation:

The set command lists all defined variables and functions within Bash, including local, environment, and shell variables, as well as aliases and functions. The output of set can be very long, so it is often piped to less, grep, or other commands for filtering or paging. The set command can also be used to set or unset shell options and positional parameters.The -o posix option to set limits the output to only variables, as defined by the POSIX standard123.

The env command lists only the environment variables, which are a subset of the shell variables that are passed to child processes. The env command can also be used to run a command in a modified environment, or to print or set environment variables.The -a option to env is not valid in most implementations45.

The echo command prints a line of text to the standard output. The $ENV variable is not a predefined variable in Bash, but it can be set by the user or by other programs.If it is not set, echo $ENV will print a blank line1.Reference:


Question 15

A French user has installed the French language pack, but currencies are still being displayed with a leading '$' sign in his spreadsheets. What must be done to fix this?

Correct Answer: A. Alter the locale.
Explanation:

The locale is a set of environmental variables that defines the language, country, and character encoding settings for the applications and shell session on a Linux system.The locale affects things such as the time/date format, the first day of the week, numbers, currency and many other values formatted in accordance with the language or region/country you set on a Linux system1.The currency sign () is a character used to denote an unspecified currency2. To display the correct currency symbol for a specific region, the locale must be set accordingly.For example, to display the euro symbol () for France, the locale can be set to fr_FR.UTF-81.Setting the timezone correctly, editing /etc/currency, or reinstalling the French language pack will not affect the currency symbol displayed in the spreadsheets.Reference:1: How to Change or Set System Locales in Linux - Tecmint2: decimal.ToString (''C'') produces currency symbol on Linux - Stack Overflow