Data Types Practice

Data Types Practice#

These questions are to assess your understanding of the different Java data types and how they should be used.

Questions 1

Imagine you are writing a program that stores a high school or college student’s class year, which can take the values of Freshman, Sophomore, Junior, or Senior. Which of the folloing is an appropriate data type for this information?

  • Integer

  • Double

  • String


Question 2

Imagine you are writing a program that stores the number of gel pens you have. What is an appropriate data type for this information?

  • Integer

  • Double

  • String