ExamGecko
Home Home / LPI / 102-500
Ask QuestionAsk Question

LPI 102-500 Practice Test - Questions Answers

Question list
Search
Search

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

A.
result: 3 4 5 6 2 1
A.
result: 3 4 5 6 2 1
Answers
B.
result: 1 2 3 4 5 6
B.
result: 1 2 3 4 5 6
Answers
C.
result: 6 5 4
C.
result: 6 5 4
Answers
D.
result: 6 5 4 3 2 1
D.
result: 6 5 4 3 2 1
Answers
E.
result: 3 2 1
E.
result: 3 2 1
Answers
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
26 questions

Question 2

Report
Export
Collapse

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

A.
It is the process ID of the echo command.
A.
It is the process ID of the echo command.
Answers
B.
It is the process ID of the current shell.
B.
It is the process ID of the current shell.
Answers
C.
It is the exit value of the command executed immediately before echo.
C.
It is the exit value of the command executed immediately before echo.
Answers
D.
It is the exit value of the echo command.
D.
It is the exit value of the echo command.
Answers
Suggested answer: C
asked 18/09/2024
Idan Bar-On
37 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.)

A.
VALUES, values
A.
VALUES, values
Answers
Suggested answer: A
asked 18/09/2024
Niall Dempsey
35 questions

Question 4

Report
Export
Collapse

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

A.
export $VARIABLE
A.
export $VARIABLE
Answers
B.
export VARIABLE
B.
export VARIABLE
Answers
C.
set $VARIABLE
C.
set $VARIABLE
Answers
D.
set VARIABLE
D.
set VARIABLE
Answers
E.
env VARIABLE
E.
env VARIABLE
Answers
Suggested answer: B
asked 18/09/2024
waleed Haridi
34 questions

Question 5

Report
Export
Collapse

What output will the command seq 10 produce?

A.
A continuous stream of numbers increasing in increments of 10 until stopped.
A.
A continuous stream of numbers increasing in increments of 10 until stopped.
Answers
B.
The numbers 1 through 10 with one number per line.
B.
The numbers 1 through 10 with one number per line.
Answers
C.
The numbers 0 through 9 with one number per line.
C.
The numbers 0 through 9 with one number per line.
Answers
D.
The number 10 to standard output.
D.
The number 10 to standard output.
Answers
Suggested answer: B
asked 18/09/2024
Alex Amponsah
40 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.)

A.
/etc/skel
A.
/etc/skel
Answers
Suggested answer: A
asked 18/09/2024
Luis Morales
30 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.)

A.
select
A.
select
Answers
Suggested answer: A
asked 18/09/2024
Angela Stevens
59 questions

Question 8

Report
Export
Collapse

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

A.
A B
A.
A B
Answers
B.
A B C
B.
A B C
Answers
C.
A C
C.
A C
Answers
D.
B C
D.
B C
Answers
E.
C B A
E.
C B A
Answers
Suggested answer: A
asked 18/09/2024
Komalaharshini Basireddygari
42 questions

Question 9

Report
Export
Collapse

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

A.
mydate="$(date)"
A.
mydate="$(date)"
Answers
B.
mydate="exec date"
B.
mydate="exec date"
Answers
C.
mydate="$((date))"
C.
mydate="$((date))"
Answers
D.
mydate="date"
D.
mydate="date"
Answers
E.
mydate="${date}"
E.
mydate="${date}"
Answers
Suggested answer: A
asked 18/09/2024
Pablo Magallanes
38 questions

Question 10

Report
Export
Collapse

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

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