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

A1:

b. Commas are used to separate things within a section, but semicolons separate sections.

A2:

a. The break statement ends a loop entirely, and continue skips to the next go-round of the loop.

A3:

c. Though I'm not sure my father has completely forgiven me for that incident in 1987.

      
Comments