ACTUAL Exam Questions and CORRECT
Answers
Because stderr and stdout represent the results of a command and stdin represents the input
required for a command, only stderr and stdout can be redirected to/from a file. True or False? -
CORRECT ANSWER - False
The current value for the HOME variable is displayed by which of the following commands?
(Choose all that apply.) - CORRECT ANSWER - echo $HOME
echo ~
What does &> accomplish when entered on the command line after a command? - CORRECT
ANSWER - It redirects both stderr and stdout to the same location
Which of the following will display the message welcome home if the cd /home/user1 command
is successfully executed?
cd /home/user1 && echo "welcome home"
cat "welcome home" || cd /home/user1
cd /home/user1 || cat "welcome home"
echo "welcome home" && cd /home/user1 - CORRECT ANSWER - cd /home/user1 &&
echo "welcome home"
Which of the following lines can be used to perform command substitution within a shell script?
(Choose all that apply.) - CORRECT ANSWER - `command`
$(command)
The sed and awk commands are filter commands commonly used to format data within a pipe.
True or False? - CORRECT ANSWER - True
, Which of the following variables could access the value "/etc" within the sample shell script, if
the sample shell script was executed using the bash sample /var /etc /bin command? - CORRECT
ANSWER - $2
Which of the following files is always executed immediately after any user logs in to a Linux
system and receives a BASH shell? - CORRECT ANSWER - /etc/profile
Every if construct begins with if and must be terminated with? - CORRECT ANSWER - fi
Which of the following operators reverses the meaning of a test statement? - CORRECT
ANSWER -!
What would be the effect of using the alias command to make an alias for the date command
named cat in honor of your favorite pet? - CORRECT ANSWER - When you use the cat
command at the command prompt with the intention of viewing a text file, the date appears
instead.
Before a user-defined variable can be used by processes that run in subshells, that variable must
be __________. - CORRECT ANSWER - exported
You attempt to perform the git commit -m "Added listdir function" but the command fails. What
are possible reasons for the failure? (Choose all that apply.) - CORRECT ANSWER - No
files were added to the Git index beforehand.
The user performing the commit has not set their Git user information.
The user performing the commit is not running the command from within the Git repo directory.
Which construct can be used in a shell script to read stdin and place it in a variable? - CORRECT
ANSWER - read
You have redirected stderr to a file called Errors. You view the contents of this file afterward and
notice that there are six error messages. After repeating the procedure, you notice that there are
only two error messages in this file. Why? - CORRECT ANSWER - You did not append