Variables and Data Types MCQ Practice

Question 1 of 10

A campus radio booth records how many compact discs remain in the live-play rack. The value is a whole number from 0 through 40. Which type best matches this count?

  1. A. boolean
  2. B. int
  3. C. double
  4. D. A reference type named DiscObject

Question 2 of 10

The mixing board reports output loudness as values such as 6.25. Which primitive type is appropriate?

  1. A. boolean
  2. B. int
  3. C. A reference type, required for any measured quantity
  4. D. double

Question 3 of 10

Producers store only whether the on-air warning light is lit. Which type models that state directly?

  1. A. boolean
  2. B. int
  3. C. double
  4. D. A reference type named Studio

Question 4 of 10

A PlaylistCart object holds a cart number, a show title, and scheduled start notes together. Which category describes PlaylistCart?

  1. A. Primitive integer
  2. B. Primitive Boolean
  3. C. Reference
  4. D. Primitive, because a cart number can be an int

Question 5 of 10

Which description of a data type is complete for AP CSA?

  1. A. The identifier chosen for a variable
  2. B. A set of values together with the operations those values support
  3. C. The most recent value currently stored in memory
  4. D. Whether a name starts with a capital letter

Question 6 of 10

Which declaration introduces a Boolean variable named micLive?

  1. A. boolean micLive;
  2. B. int micLive;
  3. C. micLive boolean;
  4. D. double micLive;

Question 7 of 10

Consider this declaration. Which statement is accurate?

int cartSlots;
  1. A. The type is cartSlots and the name is int.
  2. B. The variable holds a Boolean value.
  3. C. The declaration is missing a type.
  4. D. The name is cartSlots and the type is int.

Question 8 of 10

Using the table, which declaration matches peakLevel?

Name Need
jingleCount Whole-number jingles queued
peakLevel Loudness that may include a fraction
towerOnline Whether the transmitter is powered
  1. A. boolean peakLevel;
  2. B. int peakLevel;
  3. C. double peakLevel;
  4. D. Transmitter peakLevel;

Question 9 of 10

In Java, a primitive variable is declared by writing the type keyword before the identifier. Which line follows that rule for a fractional music-bed duration named bedTime?

  1. A. bedTime double;
  2. B. double bedTime;
  3. C. duration bedTime;
  4. D. boolean bedTime;

Question 10 of 10

Which statement about the declaration boolean requestLineOpen; is correct?

  1. A. requestLineOpen is a name associated with a memory location that can hold a Boolean value.
  2. B. The identifier requestLineOpen makes the type int.
  3. C. The declaration creates a reference to a Request object.
  4. D. A primitive Boolean variable stores the memory address of an object.