Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Quiz

The following questions will test your knowledge of loops. In the spirit of the subject matter, repeat each of these until you get them right.

Questions

  1. What must be used to separate each section of a for statement?
    1. commas
    2. semicolons
    3. off-duty police officers
  2. Which statement causes a program to go back to the statement that began a loop and then keep going from there?
    1. continue
    2. next
    3. skip
  3. When it comes to borrowing a car from your father, what lesson did you learn during this hour?
    1. Don't even think about it.
    2. Speak softly and carry a big stick.
    3. It's better to beg forgiveness than to ask permission.

Answers

  1. b. Commas are used to separate things within a section, but semicolons separate sections.
  2. a. The break statement ends a loop entirely, and continue skips to the next go-round of the loop.
  3. c. Though I'm not sure my father has completely forgiven me for that incident in 1987.

Share ThisShare This

Informit Network