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

Page: 1 / 14
Total 234 questions
Question 1

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



Answer : B

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 2

What is the purpose of the nsswitch.conf file?



Answer : A

The nsswitch.conf file is a configuration file that determines the sources and the order of the sources that are queried for various system databases, such as user information, group information, host names, network services, and more. The C library uses this file to look up various system information when a program or a command requests it. For example, when a user logs in, the C library will use the nsswitch.conf file to determine where to find the user's password, whether it is in the local /etc/passwd file, or in a remote LDAP server, or both. The nsswitch.conf file allows the system administrator to configure the system databases in a flexible and modular way.Reference:

[LPI Linux Essentials - Topic 106: The Linux Operating System]

[LPI Linux Administrator - Exam 102 Objectives - Topic 110: Security]

[Linux man page for nsswitch.conf]


Question 3

Which of the following options in the chrony configuration file define remote lime sources? (Choose TWO correct answers.)



Answer : D, E


Question 4

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

____ i in *.txt; do

echo $i

done



Answer : B

Thesetcommand 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.Thesetcommand can be used in any POSIX-compliant shell, such as bash, zsh, ksh, etc123.

The other options are not correct because:

envis 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 -ais an invalid option for theenvcommand.The-aoption is not supported by theenvcommand in any standard or common implementation45.

echo $ENVis used to print the value of the environment variableENV, not the list of all shell variables. TheENVvariable 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 .


Question 5

What is Irue regarding public and private SSH keys? (Choose TWO correct answers.)



Answer : B, D


Question 6

Which of the following information is stored in /etc/shadow for each user?



Answer : C

The /etc/shadow file is a text file that stores encrypted passwords, along with user name, password expiration values, and last password change date. The credential information in the shadow file is encrypted using a one-way hash function to disable decryption. The /etc/shadow file contains one entry per line for each user listed in /etc/passwd file. Each line of the /etc/shadow file contains nine comma-separated fields, and the second field is the encrypted password of the user. The password field uses the $type$salt$hashed format, where $type is the method of cryptographic hash algorithm, salt is a random string, and hashed is the result of applying the hash function to the user's password and the salt. The /etc/shadow file is only readable by the root user, and it is used to enhance the security and control of user passwords.

The other information listed are not stored in /etc/shadow file, but in /etc/passwd file. The /etc/passwd file is a text file that contains basic information about each user account on the system. Each line of the /etc/passwd file contains seven colon-separated fields, and they are:

Username: The name of the user account.

Password: An x character indicates that the encrypted password is stored in /etc/shadow file.

User ID (UID): The numerical identifier of the user account.

Group ID (GID): The numerical identifier of the primary group of the user account.

User ID Info: The comment field that can store additional information about the user, such as full name, phone number, etc.

Home Directory: The absolute path to the user's home directory, where the user's personal files and settings are stored.

Shell: The absolute path to the user's default login shell, which is the program that runs when the user logs in to the system.


Understanding the /etc/shadow File | Linuxize

Understanding /etc/shadow file format on Linux - nixCraft

/etc/shadow file format | Linux#

[/etc/passwd file format | Linux#]

Question 7

What of the following can be done by the command ifconfig? (Choose TWO correct answers.)



Answer : A, D

The command ifconfig can be used to set a network interface active or inactive by using the up or down options. For example, the following command will activate the eth0 interface:

sudo ifconfig eth0 up

The command ifconfig can also be used to change the netmask used on a network interface by specifying the netmask option followed by the desired netmask value. For example, the following command will change the netmask of the eth0 interface to 255.255.255.0:

sudo ifconfig eth0 netmask 255.255.255.0

The other options in the question are not possible with the ifconfig command. The command ifconfig cannot specify the kernel module to be used with a network interface. This is done by the modprobe command or the /etc/modules file. The command ifconfig cannot allow regular users to change the network configuration of a network interface. This is controlled by the sudoers file or the polkit framework. The command ifconfig cannot specify which network services are available on a network interface. This is done by the firewall rules or the /etc/services file.Reference:

[LPI Linux Administrator - Exam 102 Objectives - Topic 109: Networking Fundamentals]

Linux ifconfig Command | Linuxize

15 Useful ''ifconfig'' Commands to Configure Network in Linux - Tecmint

ifconfig command in Linux with Examples - GeeksforGeeks


Page:    1 / 14   
Total 234 questions