Linux+ Networking Chapter 8

20 Questions  I  By Ajeff
Please take the quiz to rate it.

Linux Networking Quizzes & Trivia
Linux+ Networking Chapter 8

  
Changes are done, please start the quiz.


Questions and Answers

Removing question excerpt is a premium feature

Upgrade and get a lot more done!
  • 1. 
    Because Standard Error and Standard Ouput represent the results of a command and Standard Input represents the input required for a command, only Standard Error and Standard Ouput can be redirected to/from a file. True or False?
    • A. 

      True

    • B. 

      False


  • 2. 
    Before a user-defined variable can be used by processes that run in subshells, that variable must be ____________.
    • A. 

      Imported

    • B. 

      Validated by running the env command

    • C. 

      Exported

    • D. 

      Redirected to the BASH shell


  • 3. 
    The alias command can be used to make a shortcut to a single command.  True or False?
    • A. 

      True

    • B. 

      False


  • 4. 
    Which of the following files is always executed immediately after a user logs in to a Linux system and receives a BASH shell?
    • A. 

      /etc/profile

    • B. 

      ~/.bash_profile

    • C. 

      ~/.bash_login

    • D. 

      ~/.profile


  • 5. 
    Which command could you use to see a list of all environment and user-defined shell variables as well as their current values?
    • A. 

      Ls /var

    • B. 

      Env

    • C. 

      Set

    • D. 

      Echo


  • 6. 
    Every if construct begins with if and must be terminated with?
    • A. 

      End

    • B. 

      Endif

    • C. 

      Stop

    • D. 

      Fi


  • 7. 
    Which of the following will display the message welcome home if the cd /home/user1 command is successfully executed?
    • A. 

      Cd /home/user1 && echo “welcome home”

    • B. 

      Cat “welcome home” || cd /home/user1

    • C. 

      Cd /home/user1 || cat “welcome home”

    • D. 

      Echo “welcome home” && cd /home/user1


  • 8. 
    The current value for the HOME variable is displayed by which of the following commands? (Choose all that apply.)
    • A. 

      Echo HOME=

    • B. 

      Echo ~

    • C. 

      Echo $HOME

    • D. 

      Echo ls HOME


  • 9. 
    Which of the following file descriptor numbers represents stdout?
    • A. 

      2

    • B. 

      0

    • C. 

      1

    • D. 

      3


  • 10. 
    Which of the following operators reverses the meaning of a test statement?
    • A. 

      #!

    • B. 

      -o

    • C. 

      -a

    • D. 

      !


  • 11. 
    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?
    • A. 

      It cannot be done as there already is an environment variable cat associated with the cat command.

    • B. 

      It cannot be done as there already is a command cat on the system.

    • C. 

      When you use the cat command at the command prompt with the intention of viewing a text file, the date appears instead.

    • D. 

      There is no effect until the alias is imported as it is a user-declared variable.


  • 12. 
    How do you indicate a comment line in a shell script?
    • A. 

      There are no comment lines in a shell script.

    • B. 

      Begin the line with #!.

    • C. 

      Begin the line with !.

    • D. 

      Begin the line with #.


  • 13. 
    You have redirected Standard Error 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?
    • A. 

      After you open the file and view the contents, the contents are lost.

    • B. 

      The system generated different Standard Ouput.

    • C. 

      You did not append the Standard Error to the Error file and as a result, it was overwritten when the command was run a second time.

    • D. 

      You must specify a new file each and every time you redirect as the system creates the specified file by default.


  • 14. 
    The sed and awk commands are filter commands commonly used to format data within a pipe. True or False?
    • A. 

      True

    • B. 

      False


  • 15. 
    What is wrong with the following command string ls /etc/hosts   >listofhostfile?
    • A. 

      Nothing is wrong with the command.

    • B. 

      The file descriptor was not declared; unless 1 for Standard Ouput or 2 for Standard Error is indicated, the command will fail.

    • C. 

      The ls command is one of the commands that cannot be used with redirection; you must use | to pipe instead.

    • D. 

      The file listofhostfile will always only contain Standard Error as a file descriptor was not declared.


  • 16. 
    Which of the following is not necessarily generated by every command on the system? (Choose all that apply.)
    • A. 

      Standard Input

    • B. 

      Standard Deviation

    • C. 

      Standard Ouput

    • D. 

      Standard Error


  • 17. 
    Which construct can be used in a shell script to read Standard Input and place it in a variable?
    • A. 

      Read

    • B. 

      Sum

    • C. 

      Verify

    • D. 

      Test


  • 18. 
    A variable identifier must ____________.
    • A. 

      Not begin with a number

    • B. 

      Not begin with a capital letter

    • C. 

      Start with a number

    • D. 

      Start with an underscore “_”


  • 19. 
    What does >> accomplish when entered on the command line after a command?
    • A. 

      It redirects both Standard Error and Standard Ouput to the same location.

    • B. 

      It does not accomplish anything.

    • C. 

      It redirects Standard Error and Standard Input to the same location.

    • D. 

      It appends Standard Ouput to a file.


  • 20. 
    Consider the following shell script:                 echo -e “What is your favorite color?--> \c”                  read REPLY                 if [ “$REPLY” = “red”  –o  “$REPLY” = “blue” ]                 then                    echo “The answer is red or blue.”                 else                      echo “The answer is not red nor blue.”                 fi  What would be displayed if a user executes this program and answered Blue when prompted?
    • A. 

      The answer is red or blue.

    • B. 

      The answer is not red nor blue.

    • C. 

      The code would cause an error.

    • D. 

      The answer is red or blue. The answer is not red nor blue.


Back to top

Removing ad is a premium feature

Upgrade and get a lot more done!
Take Another Quiz
We have sent an email with your new password.