Quiz on Primitive Data Types

This is a practice quiz. The results are not recorded anywhere and do not affect your grade. The questions on this quiz might not appear in any quiz or test that does count toward your grade.

Instructions: For each question, choose the single best answer. Make your choice by clicking on its button. You can change your answers at any time. When the quiz is graded, the correct answers will appear in the box after each question.

1. What is a data type?

a. The part of the CPU that does arithmetic.
b. A part of main memory used to store data.
c. A particular scheme for represending values with bit patterns.
d. The collection of variables that a program uses.

2. How many patterns can be created using a single bit?

a. 1
b. 2
c. 4
d. 8

3. What is a Java primitive data type?

a. A method for representing values that is so useful that it is a fundamental part of the language.
b. A crude form of representing numbers.
c. The part of Java that is the same as in older languages.
d. A data type that cannot be used as part of an object.

4. Does every Java variable use a data type?

a. No---only numeric variables use data types.
b. No---data types are optional.
c. Yes---all variables are of the same data type.
d. Yes---each variable must be declared along with its data type.

5. Which of the following is NOT the name of a Java primitive data type?

a. int
b. float
c. double
d. String

6. Is the value ONE always going to be represented by using the same pattern of bits?

a. Yes---there is only one "one" so there will be just one pattern.
b. No---"one" can be represented using several integer data types or floating point data types.
c. Yes---it will always be stored in one bit.
d. No---the pattern will change each time the program is run.

7. Say that a particular item of data does NOT use a primitive data type. What must it be?

a. An object.
b. A number.
c. A literal.
d. A boolean.

8. How many places of decimal precision are there in the following number: +1200004.5

a. 4
b. 5
c. 8
d. More than a million

9. Can character data be stored in computer memory?

a. No---computers can only store numbers.
b. No---computer memory can only store patterns.
c. Yes---characters are stored in special memory.
d. Yes---a primitive data type is used to store characters.

10. In which of the following answers does the number of bits increase from fewest (on the left) to most (on the right)?

a. byte  long  short  int
b. int  byte  short  long
c. byte  short  int  long
d. short  byte  long  int

The number you got right:       Percent Correct:       Letter Grade:   

(If you have just returned here from another page, or re-loaded this page, you will need to click again on each of your choices for the grading program to work.)

Click here to go back to the main menu.