ExamGecko
Home Home / LPI / 010-160

LPI 010-160 Practice Test - Questions Answers, Page 7

Question list
Search
Search

What is the purpose of the PATH environment variable?

A.
It allows the execution of commands without the need to know the location of the executable.
A.
It allows the execution of commands without the need to know the location of the executable.
Answers
B.
It increases security by preventing commands from running in certain locations.
B.
It increases security by preventing commands from running in certain locations.
Answers
C.
It specifies the location of a user's home directory.
C.
It specifies the location of a user's home directory.
Answers
D.
It indicates the location of the default shell to be used when a user logs in.
D.
It indicates the location of the default shell to be used when a user logs in.
Answers
E.
It contains the absolute path to the current directory.
E.
It contains the absolute path to the current directory.
Answers
Suggested answer: A

Which of the following commands sets the variable USERNAME to the value bob?

A.
set USERNAME bob
A.
set USERNAME bob
Answers
B.
$USERNAME==bob
B.
$USERNAME==bob
Answers
C.
var USERNAME=bob
C.
var USERNAME=bob
Answers
D.
USERNAME<=bob
D.
USERNAME<=bob
Answers
E.
USERNAME=bob
E.
USERNAME=bob
Answers
Suggested answer: E

FILL BLANK

What command displays manual pages? (Specify ONLY the command without any path or parameters.)

A.
man
A.
man
Answers
Suggested answer: A

Which command copies the contents of the directory /etc/, including all sub-directories, to /root/?

A.
copy /etc /root
A.
copy /etc /root
Answers
B.
cp -r /etc/* /root
B.
cp -r /etc/* /root
Answers
C.
cp -v /etc/* /root
C.
cp -v /etc/* /root
Answers
D.
rcp /etc/* /root
D.
rcp /etc/* /root
Answers
E.
cp -R /etc/*.* /root
E.
cp -R /etc/*.* /root
Answers
Suggested answer: B

Which of the following commands puts the lines of the file data.csv into alphabetical order?

A.
a..z data.csv
A.
a..z data.csv
Answers
B.
sort data.csv
B.
sort data.csv
Answers
C.
abc data.csv
C.
abc data.csv
Answers
D.
wc -s data.csv
D.
wc -s data.csv
Answers
E.
grep --sort data.csv
E.
grep --sort data.csv
Answers
Suggested answer: B

Which of the following examples shows the general structure of a for loop in a shell script?

A.
for *.txt as file => echo $file
A.
for *.txt as file => echo $file
Answers
B.
for *.txt ( echo $i )
B.
for *.txt ( echo $i )
Answers
C.
for file in *.txt do echo $idone
C.
for file in *.txt do echo $idone
Answers
D.
for ls *.txt exec {} \;
D.
for ls *.txt exec {} \;
Answers
E.
foreach @{file} { echo $i}
E.
foreach @{file} { echo $i}
Answers
Suggested answer: C

Which operator in a regular expression matches the preceding character either zero or one time?

A.
?
A.
?
Answers
B.
*
B.
*
Answers
C.
+
C.
+
Answers
D.
%
D.
%
Answers
E.
$
E.
$
Answers
Suggested answer: A

The file script.sh in the current directory contains the following content:

#!/bin/bash echo $MYVAR

The following commands are used to execute this script:

MYVAR=value

./script.sh

The result is an empty line instead of the content of the variable MYVAR. How should MYVAR be set in order to make script.sh display the content of MYVAR?

A.
!MYVAR=value
A.
!MYVAR=value
Answers
B.
env MYVAR=value
B.
env MYVAR=value
Answers
C.
MYVAR=value
C.
MYVAR=value
Answers
D.
$MYVAR=value
D.
$MYVAR=value
Answers
E.
export MYVAR=value
E.
export MYVAR=value
Answers
Suggested answer: E

What is the return value of a shell script after successful execution?

A.
1
A.
1
Answers
B.
0
B.
0
Answers
C.
-1
C.
-1
Answers
D.
-255
D.
-255
Answers
E.
255
E.
255
Answers
Suggested answer: B

Which of the following commands creates the ZIP archive poems.zip containing all files in the current directory whose names end in .txt?

A.
zip *.txt > poems.zip
A.
zip *.txt > poems.zip
Answers
B.
zcat *.txt poems.zip
B.
zcat *.txt poems.zip
Answers
C.
zip poems.zip *.txt
C.
zip poems.zip *.txt
Answers
D.
zip cfz poems.zip *.txt
D.
zip cfz poems.zip *.txt
Answers
E.
cat *.txt | zip poems.zip
E.
cat *.txt | zip poems.zip
Answers
Suggested answer: C
Total 80 questions
Go to page: of 8