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

  1. In a for ... in loop, where does the loop variable get its values?
    from the list of values following the keyword in
  2. In a simple for loop, where does the loop variable get its values?
    from the command line arguments
  3. Should the loop variable in a for loop have a $ in front of it?
    no
  4. In a three statement for loop, what does the first statement do?
    sets the initial value of a loop variable
  5. In a three statement for loop, what does the second statement do?
    it's a logical expression and the loop will continue as long as its value is true
  6. In a three statement for loop, what does the third statement do?
    changes the value of the loop variable after each pass through the loop
  7. Why are the three statements in a three statement for loop surrounded by two parentheses?
    so the values of all variables will be treated as numbers
  8. When does a while loop stop running?
    when the command following while returns an exit status that is not 0
  9. What does the continue command in a loop do?
    stops that pass through the loop and returns to the top of the loop
  10. What does the break command in a loop do?
    jumps completely out of the loop