IT 244: Introduction to Linux/Unix
Answers to Class 22 Ungraded Quiz

  1. What are control structures?
    syntactic structures that control how and when other statements are executed
  2. What are the two basic types of control structures?
    conditionals and loops
  3. What is the basic format of the if ... then construct?
    if COMMAND
    then
        COMMAND_1
        COMMAND_2
        ...
    fi
  4. How is the command that follows if used to determine whether or not the statements between the then and fi keywords are executed?
    if the command returns an exit status of 0 the statements are executed
  5. What does an exit status of 0 mean?
    that the command that returned the status code ran without error
  6. What are the two keywords that surround the statements inside an if statement?
    then and fi
  7. Can the then keyword appear on the same line as if ?
    yes, but only if it is separated from it by a semicolon (;)
  8. What does the test command do?
    analyze a logical expression and return an exit status that tells	
    whether the expression is true or false
  9. What is the value of the exit status returned by test to indicate that the expression is true?
    0
  10. Does the command that follows if need to be test?
    no, it can be any command that returns an exit status