Objects: Instances of Classes MCQ Practice

Question 1 of 10

A greenhouse club uses class Terrarium as the blueprint for classroom habitats. Mesa is the habitat currently on the west window shelf. What is Mesa?

  1. A. The Terrarium class itself
  2. B. A primitive int stored in Terrarium
  3. C. One object: an instance of Terrarium with its own current state
  4. D. A required Java inheritance declaration

Question 2 of 10

In Java’s conceptual class hierarchy used on the AP CSA exam, which class is the root that every class belongs under?

  1. A. String
  2. B. Object
  3. C. System
  4. D. Main

Question 3 of 10

A course note says every Piano is conceptually a more specific Instrument, and every Instrument is a kind of Object. Students are not asked to write extends. Which statement matches AP CSA topic 1.12?

  1. A. Piano objects are outside the Object hierarchy until a student codes inheritance.
  2. B. Instrument is the root class instead of Object.
  3. C. The hierarchy is conceptual: Object is the root, and a Piano is still an Object even though students do not implement inheritance.
  4. D. Two Piano objects become subclasses of each other because they share a class name.

Question 4 of 10

The table describes two kiln loads that already exist. Which statement is correct?

Reference Class cone glaze
morningLoad KilnLoad 6 celadon
eveningLoad KilnLoad 10 shino
  1. A. They must belong to different classes because cone differs.
  2. B. morningLoad is the superclass of eveningLoad.
  3. C. The table shows one object listed twice.
  4. D. They are two independent KilnLoad instances with different attribute values.

Question 5 of 10

Class FerryPass defines punch() and remaining() behaviors. What provides those behaviors to each FerryPass object?

  1. A. Only the spelling of the reference variable that currently names the object
  2. B. The FerryPass class definition, including behavior inherited from Object
  3. C. A required student-written subclass for every ticket
  4. D. The current integer stored in remaining() before any method exists

Question 6 of 10

A harbor program already compiled class Beacon. How many Beacon objects may that program create?

  1. A. Exactly one, because a class is itself a single object
  2. B. None, because Object forbids extra instances
  3. C. As many as the program constructs; the class is a reusable blueprint
  4. D. Only two, which Java then treats as subclasses of each other

Question 7 of 10

What does this Java declaration do by itself?

RadioStation kexp = null;
  1. A. It constructs a RadioStation object and stores the object inside kexp as a primitive.
  2. B. It declares a RadioStation reference variable whose current reference value is null.
  3. C. It makes kexp a subclass of RadioStation.
  4. D. It copies every RadioStation attribute into an int.

Question 8 of 10

After this code runs, which statement is true?

Beacon north = new Beacon(3);
Beacon also = north;
  1. A. also names a second, independent Beacon with flash count 3.
  2. B. north and also store the same reference value, so they refer to one Beacon object.
  3. C. also stores a primitive copy of 3 and is no longer a Beacon.
  4. D. The assignment constructs a subclass of Beacon named also.

Question 9 of 10

A cafeteria tracks trays. After this code, which object does spare refer to?

Tray spare = new Tray(8);
Tray cart = spare;
spare = new Tray(2);
  1. A. The Tray whose count is 8
  2. B. The Tray whose count is 2
  3. C. No object; spare must be null after any second new
  4. D. Both trays at once, because Java merges aliased objects

Question 10 of 10

Which statement about Poster p = null; is accurate?

  1. A. p currently holds a Poster object with default text.
  2. B. p currently holds the null reference value and does not refer to a Poster object.
  3. C. p is illegal because reference variables cannot store null.
  4. D. p automatically constructs Object instead of Poster.