Home > Articles > Programming > Java

  • Print
  • + Share This
This chapter is from the book

Quiz

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

Questions

  1. Which of the following is a valid value for a boolean variable?

    1. "false"

    2. false

    3. 10

  2. Which of these conventions is not used when naming variables in Java?

    1. Each successive word after the first in the variable name begins with a capital letter.

    2. The first letter of the variable name is lowercase.

    3. All letters are capitalized.

  3. Which of these data types holds numbers from -32,768 to 32,767?

    1. char

    2. byte

    3. short

Answers

  1. b. In Java, a boolean can only be true or false. If you put quotation marks around the value, it will be treated like a String rather than one of the two boolean values.

  2. c. Constant names are capitalized to make them stand out from other variables.

  3. c.

  • + Share This
  • 🔖 Save To Your Account