[2018]CompTIA Linux+ LX0-104 Free Questions:

1. What is true regarding the statement beginning with #! that is found in the first line of a script?
A. It prevents the script from being executed until the ! is removed.
B. It specifies the path and the arguments of the interpreter used to run the script.
C. It is a comment that is ignored by the script.
D. It specifies the character encoding of the script.
Answer: B

2.Which Bash option prevents a user from accidentally overwriting a file with a “>”?
A. set -o safe
B. set -o noglob
C. set -o noclobber
D. set -o append
E. set -o nooverwrite
Answer: C

3.Which of the following commands prints the exit value of the most recently executed program in Bash?
A. echo $?
B. echo $#
C. echo $exit
D. echo $status
E. echo $&
Answer: A

4.What word will complete an if statement in bash such as the following: if [ -x “$file” ]; then echo $file _____ (Please provide the missing word only)
Answer: fi

5.What word is missing from the following SQL statement? update tablename ____ fieldname=’value’ where id=909; (Please specify the missing word using lower\_case letters only.)
Answer: set

6.Which of the following SQL statements will select the fields name and address from the contacts table?
A. SELECT (name, address) FROM contacts;
B. SELECT (name address) FROM contacts;
C. SELECT name, address FROM contacts;
D. SELECT name address FROM contacts;
Answer: C

7.Which of the following configuration files should be modified to globally set shell variables for all users?
A. /etc/bashrc
B. /etc/profile
C. ~/.bash_profile
D. /etc/.bashrc
Answer: B

8.Which of the following commands are used to manage the environment and shell variables within a shell process? (Choose TWO correct answers.)
A. export
B. init
C. reset
D. set
E. tset
Answer: A, D

9.Which of the following are operators used for comparisons by the test command? (Choose TWO correct answers.)
A. equals
B. =
C. -is
D. -eq
E. null
Answer: B, D

10.Which of the following commands creates a function in Bash that outputs the sum of two numbers?
A. function sumitup {echo $(($1 + $2)) ;}
B. command sumitup {echo $(($1 + $2)) ;}
C. function sumitup {echo $1 + $2 ;}
D. method sumitup {echo $1 + $2 ;}
E. command sumitup {echo $1 + $2 ;}
Answer: A

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

12.When the command echo $ outputs 1, which of the following statements are true?
A. It is the process ID of the echo command.
B. It is the process ID of the current shell.
C. It is the exit value of the command executed immediately before echo.
D. It is the exit value of the echo command.
Answer: C

13.What word is missing from the following SQL statement? insert into tablename ________(909, ‘text’); (Please specify the missing word using lower-case letters only.)
Answer: VALUES, values

14.Which command makes the shell variable named VARIABLE visible to subshells?
A. export $VARIABLE
B. export VARIABLE
Answer: B

15.What output will the command seq 10 produce?
A. A continuous stream of numbers increasing in increments of 10 until stopped.
B. The numbers 1 through 10 with one number per line.
C. The numbers 0 through 9 with one number per line.
D. The number 10 to standard output.
Answer: B

16.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.)
Answer: /etc/skel, /etc/skel/

17.What word is missing from the following SQL statement?
__________ count (*) from tablename;
(Please specify the missing word using lower-case letters only.)
Answer: select

18.Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)
A. ~/.bashconf
B. ~/.bashrc
C. ~/.bashdefaults
D. ~/.bash_etc
E. ~/.bash_profile
Answer: B, E

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

20.Which of the following commands puts the output of the command date into the shell variable mydate?
A. mydate=”$(date)”
B. mydate=”exec date”
C. mydate=”$((date))”
D. mydate=”date”
E. mydate=”${date}”
Answer: A

LX0-104 Questions Full Version(PDF&Software): https://www.killtest.com/Linux/LX0-104.asp

Leave a Reply