ExamGecko
Home / LPI / 102-500 / List of questions
Ask Question

LPI 102-500 Practice Test - Questions Answers

List of questions

Question 1

Report Export Collapse

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

result: 3 4 5 6 2 1
result: 3 4 5 6 2 1
result: 1 2 3 4 5 6
result: 1 2 3 4 5 6
result: 6 5 4
result: 6 5 4
result: 6 5 4 3 2 1
result: 6 5 4 3 2 1
result: 3 2 1
result: 3 2 1
Suggested answer: E
Explanation:

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

asked 18/09/2024
Miguel Medina Parra
33 questions

Question 2

Report Export Collapse

When the command echo $ outputs 1, which of the following statements is true?

It is the process ID of the echo command.
It is the process ID of the echo command.
It is the process ID of the current shell.
It is the process ID of the current shell.
It is the exit value of the command executed immediately before echo.
It is the exit value of the command executed immediately before echo.
It is the exit value of the echo command.
It is the exit value of the echo command.
Suggested answer: C
asked 18/09/2024
Idan Bar-On
42 questions

Question 3

Report Export Collapse

What word is missing from the following SQL statement? insert into tablename ________(909, 'text');

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

VALUES, values
VALUES, values
Suggested answer: A
asked 18/09/2024
Niall Dempsey
38 questions

Question 4

Report Export Collapse

Which command makes the shell variable named VARIABLE visible to subshells?

export $VARIABLE
export $VARIABLE
export VARIABLE
export VARIABLE
set $VARIABLE
set $VARIABLE
set VARIABLE
set VARIABLE
env VARIABLE
env VARIABLE
Suggested answer: B
asked 18/09/2024
waleed Haridi
38 questions

Question 5

Report Export Collapse

What output will the command seq 10 produce?

A continuous stream of numbers increasing in increments of 10 until stopped.
A continuous stream of numbers increasing in increments of 10 until stopped.
The numbers 1 through 10 with one number per line.
The numbers 1 through 10 with one number per line.
The numbers 0 through 9 with one number per line.
The numbers 0 through 9 with one number per line.
The number 10 to standard output.
The number 10 to standard output.
Suggested answer: B
asked 18/09/2024
Alex Amponsah
44 questions

Question 6

Report Export Collapse

By default, the contents of which directory will be copied to a new user's home directory when the account is created by passing the -m option to the useradd command? (Specify the full path to the directory.)

/etc/skel
/etc/skel
Suggested answer: A
asked 18/09/2024
Luis Morales
32 questions

Question 7

Report Export Collapse

What word is missing from the following SQL statement?

__________ count(*) from tablename;

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

select
select
Suggested answer: A
asked 18/09/2024
Angela Stevens
64 questions

Question 8

Report Export Collapse

After issuing: function myfunction { echo $1 $2 ; } in Bash, which output does: myfunction A B C Produce?

A B
A B
A B C
A B C
A C
A C
B C
B C
C B A
C B A
Suggested answer: A
asked 18/09/2024
Komalaharshini Basireddygari
48 questions

Question 9

Report Export Collapse

Which of the following commands puts the output of the command date into the shell variable mydate?

mydate="$(date)"
mydate="$(date)"
mydate="exec date"
mydate="exec date"
mydate="$((date))"
mydate="$((date))"
mydate="date"
mydate="date"
mydate="${date}"
mydate="${date}"
Suggested answer: A
asked 18/09/2024
Pablo Magallanes
43 questions

Question 10

Report Export Collapse

Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)

~/.bashconf
~/.bashconf
~/.bashrc
~/.bashrc
~/.bashdefaults
~/.bashdefaults
~/.bash_etc
~/.bash_etc
~/.bash_profile
~/.bash_profile
Suggested answer: B, E
asked 18/09/2024
Jeffrey Ding
36 questions
Total 235 questions
Go to page: of 24