LPI 102-500 Practice Test - Questions Answers
List of questions
Related questions
Question 1
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
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
Question 2
When the command echo $ outputs 1, which of the following statements is true?
Question 3
What word is missing from the following SQL statement? insert into tablename ________(909, 'text');
(Please specify the missing word using lower-case letters only.)
Question 4
Which command makes the shell variable named VARIABLE visible to subshells?
Question 5
What output will the command seq 10 produce?
Question 6
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.)
Question 7
What word is missing from the following SQL statement?
__________ count(*) from tablename;
(Please specify the missing word using lower-case letters only.)
Question 8
After issuing: function myfunction { echo $1 $2 ; } in Bash, which output does: myfunction A B C Produce?
Question 9
Which of the following commands puts the output of the command date into the shell variable mydate?
Question 10
Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)
Question