Objects vs. Primitives
Inheritance
Polymorphism
Object Superclass
Composition
100

What is the main difference in memory storage between primitives and objects?

A. Primitives store references, objects store direct values
B. Primitives store values directly, objects store references to data
C. Both store references, but objects store more data
D. Both store values directly

B. Primitives store values directly, objects store references to data

100

An IS-A relationship represents:

A. A component relationship
B. A subclass-superclass relationship
C. Two unrelated classes
D. A variable stored inside another class

B. A subclass-superclass relationship

100

Polymorphism allows:

A. Multiple constructors in one class
B. One variable type to refer to many subclass objects
C. A class to inherit from multiple parents
D. Private variables to be public

B. One variable type to refer to many subclass objects

100

If a class does not use extends, it automatically extends:

A. Main
B. String
C. Object
D. System

C. Object

100

A HAS-A relationship describes:

A. Inheritance
B. Polymorphism
C. A whole-part relationship
D. Dynamic binding

C. A whole-part relationship

200

When a primitive is passed into a method:

A. The original variable is permanently changed
B. The method receives the original memory address
C. A copy of the value is passed
D. The variable becomes null inside the method

C. A copy of the value is passed

200

If Student extends Person, this means:

A. Student HAS-A Person
B. Person inherits Student’s methods
C. Student IS-A Person
D. Student replaces Person

C. Student IS-A Person

200

Dynamic binding means Java decides which method to execute:

A. At compile time based on variable type
B. Before the program starts
C. At runtime based on object type
D. When the class is written

C. At runtime based on object type

200

The default toString() method returns:

A. A readable summary of fields
B. Only the object’s variable names
C. The class name and memory address
D. The object’s constructor

C. The class name and memory address

200

If a Car has an Engine as an instance variable, this is:

A. Inheritance
B. Composition
C. Overriding
D. Polymorphism

B. Composition

300

When an object is passed into a method:

A. The entire object is duplicated in memory
B. The reference is copied, pointing to the same object
C. Only primitive fields are copied
D. A new object is automatically created

B. The reference is copied, pointing to the same object

300

Which members are inherited by a subclass?

A. Only private variables
B. All constructors automatically
C. Public instance methods
D. Static variables only

C. Public instance methods

300

If Shape s = new Circle(); and you call s.getArea(), Java uses:

A. Shape’s version always
B. Circle’s version at runtime
C. Both versions simultaneously
D. The version defined in main

B. Circle’s version at runtime

300

The default equals() method checks:

A. If two objects have equal data
B. If two references point to the same location
C. If two objects have the same class
D. If their toString() values match

B. If two references point to the same location

300

Composition is often preferred because:

A. It prevents method overriding
B. It eliminates constructors
C. It increases flexibility and reduces deep inheritance
D. It makes classes global

C. It increases flexibility and reduces deep inheritance

400

A NullPointerException occurs when:

A. An object runs out of memory
B. A reference variable points to multiple objects
C. A method is called on a variable that is null
D. Two objects share the same reference

C. A method is called on a variable that is null

400

Although constructors are not inherited, a subclass must:

A. Rewrite all superclass methods
B. Call the superclass constructor
C. Override every method
D. Duplicate private variables

B. Call the superclass constructor

400

Why can a method parameter declared as Shape accept a Circle object?

A. Because Circle overrides all methods
B. Because Circle IS-A Shape
C. Because Shape HAS-A Circle
D. Because Circle is abstract

B. Because Circle IS-A Shape

400

When we override equals(), we usually want to compare:

A. Memory addresses
B. Constructor types
C. Logical data inside objects
D. Object sizes

C. Logical data inside objects

400

In Java, composition is implemented by:

A. Using extends
B. Declaring an object as an instance variable
C. Overriding Object methods
D. Using static variables

B. Declaring an object as an instance variable

500

Which statement best explains why modifying an object inside a method affects the caller?

A. Java passes objects by value
B. Java copies the entire object automatically
C. Both variables refer to the same memory location
D. Objects are global by default

C. Both variables refer to the same memory location

500

All classes in Java automatically inherit from:

A. String
B. Main
C. Object
D. Class

C. Object

500

An array declared as Shape[] can store:

A. Only Shape objects
B. Only one subclass type
C. Any object unrelated to Shape
D. Shape objects and any subclass of Shape

D. Shape objects and any subclass of Shape

500

Overriding a method means:

A. Deleting the superclass version
B. Creating a new method with a different name
C. Redefining an inherited method with the same signature
D. Making the method private

C. Redefining an inherited method with the same signature

500

Which scenario best represents composition?

A. A Circle extends Shape
B. A Teacher extends Person
C. A Laptop contains a Battery object
D. A Dog overrides speak()

C. A Laptop contains a Battery object

M
e
n
u