Quiz

Review today's material by taking this three-question quiz.

Questions

1:Which loop is used to execute the statements in the loop at least once before the conditional expression is evaluated?
  1. do-while

  2. for

  3. while

2:Which operator returns the remainder of a division operation?
  1. /

  2. %

  3. ?

3:Which instance variable of an array is used to find out how big it is?
  1. size

  2. length

  3. MAX_VALUE

Answers

A1: a. The while conditional statement appears at the end of the loop. Even if it is initially false, the statements in the loop will be executed once.
A2: b. The modulus operator ("% ").
A3: b.

Get Sams Teach Yourself Java 2 in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.