wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ITC C209 Final Term Quiz 1

Total questions: 75

Worksheet time: 25mins

Name
Class
Date
1.

Which statement best reflects the concept of inheritance introduced in this section?

a)

Specialized objects are unrelated to general objects.

b)

Specialized objects are versions of more general objects found in the real world.

c)

General objects are always more complex than specialized objects.

d)

Inheritance only applies to physical size differences.

2.

Which option correctly pairs a specialized object with its more general object according to the concept of inheritance?

a)

Bee → Animal

b)

Grasshopper → Insect

c)

Dalmatian → Mammal

d)

Chihuahua → Reptile

3.

Consider the labeled grasshopper diagram. Which reasoning best explains how inheritance helps organize its features?

a)

Inheritance lists every body part of any organism.

b)

Inheritance lets the grasshopper inherit common insect traits (head, thorax, abdomen, wings) while adding its own specifics.

c)

Inheritance removes differences between insects.

d)

Inheritance applies only to mammals, not insects.

4.

Which statement best defines the "Is a" relationship in inheritance?

a)

A relationship where two objects share no characteristics

b)

A relationship indicating one object is a specialized version of another

c)

A relationship where objects are unrelated but interact

d)

A relationship that only applies to methods, not classes

5.

Select the example that illustrates an "Is a" relationship.

a)

A car has wheels

b)

A Great Dane is a dog

c)

A flower needs sunlight

d)

An insect eats plants

6.

In an "Is a" relationship, what does the specialized object inherit from the general object?

a)

Only its name

b)

All characteristics of the general object

c)

None of its characteristics

d)

Only private data fields

7.

Which statement correctly applies the concept to Java?

a)

Inheritance in Java creates a "has a" relationship among classes

b)

Inheritance in Java is used only for code duplication

c)

Inheritance in Java can create an "is a" relationship among classes

d)

Inheritance in Java cannot extend class capabilities

8.

In Java, why might you create a subclass that extends a class?

a)

To remove all methods from the superclass

b)

To create an unrelated class

c)

To build a specialized version of the class with extended capabilities

d)

To convert the class into an interface

9.

In Java, extending a class primarily serves to:

a)

Reduce its visibility to private

b)

Create a specialized class that inherits and possibly adds features

c)

Delete inherited methods

d)

Prevent polymorphism

10.

In Java, which keyword is used in the class header to indicate that one class is a subclass of another?

a)

implements

b)

extends

c)

inherits

d)

super

11.

Given the statement: public class FinalExam extends GradedActivity, what is the relationship between FinalExam and GradedActivity?

a)

FinalExam is a superclass of GradedActivity

b)

FinalExam and GradedActivity are unrelated

c)

FinalExam is a subclass of GradedActivity

d)

GradedActivity is a subclass of FinalExam

12.

A constructor for FinalExam is shown as public FinalExam(int questions, int missed). What is the most likely purpose of this constructor based on the class fields?

a)

To initialize score in GradedActivity

b)

To set numQuestions and numMissed, and compute pointsEach

c)

To set pointsEach only

d)

To create an empty FinalExam with default values

13.

Strategic reasoning: If FinalExam extends GradedActivity, how can FinalExam compute and store the overall score for the exam so that getGrade() from GradedActivity works? Choose the best approach based on the provided members.

a)

Override getGrade() in FinalExam and ignore GradedActivity

b)

Call setScore(double) from FinalExam after computing the score so GradedActivity's getGrade() can use it

c)

Make score public and set it directly in FinalExam

d)

Use getNumMissed() to replace score

14.

Which statement best describes private members of a superclass in relation to a subclass?

a)

They are inherited and directly accessible in the subclass.

b)

They are not inherited but still exist in memory when a subclass object is created.

c)

They are inherited but only accessible through protected methods.

d)

They are removed when a subclass object is created.

15.

In an object-oriented system, how can a subclass access a private member of its superclass?

a)

By declaring the member as private again in the subclass.

b)

By using public methods of the superclass that expose the private member.

c)

By referencing the member directly with super.privateMember.

d)

It cannot be accessed in any way.

16.

Which statement is true about public members of a superclass?

a)

They are not inherited by the subclass.

b)

They are inherited but cannot be accessed directly.

c)

They are inherited and may be directly accessed from the subclass.

d)

They exist only when the superclass object is created, not the subclass.

17.

A subclass object is created. What happens to the superclass's private members according to the rules provided?

a)

They do not exist in memory for the subclass object.

b)

They exist in memory but are not inherited and require public methods for access.

c)

They are promoted to public members in the subclass.

d)

They become protected members automatically.

18.

In the UML diagram, which class is the superclass that provides shared attributes and methods to graded activities?

a)

FinalExam

b)

GradedActivity

c)

ScoreManager

d)

ExamGrader

19.

A FinalExam object needs to expose how many questions were missed and the points per question. Which pair of methods from the UML diagram should be used?

a)

getScore() and getGrade()

b)

setScore(s) and FinalExam()

c)

getPointsEach() and getNumMissed()

d)

getPointsEach() and getScore()

20.

Which statement best describes constructor behavior in inheritance?

a)

Constructors are inherited by subclasses.

b)

Constructors are not inherited.

c)

Only parameterized constructors are inherited.

d)

Constructors are inherited only if marked public.

21.

When a subclass object is created, which constructor executes first by default if available?

a)

Subclass constructor

b)

Superclass default (no-arg) constructor

c)

Any parameterized constructor in subclass

d)

The most recently defined constructor

22.

What does the super keyword refer to in object-oriented programming?

a)

An object’s interface

b)

An object’s superclass

c)

An object’s package

d)

An object’s subclass

23.

How can a subclass explicitly invoke its superclass constructor?

a)

By calling this()

b)

By using the extends keyword

c)

By using the super keyword

d)

By importing the superclass

24.

If the superclass defines only a parameterized constructor and no default constructor, what must subclasses do?

a)

Provide no constructors and rely on inheritance

b)

Provide a constructor and call a superclass constructor

c)

Use this() to skip superclass initialization

d)

Declare the subclass as abstract to avoid constructors

25.

Which statement about calling a superclass constructor in a subclass is correct?

a)

It can appear anywhere in the subclass constructor.

b)

It must be the last Java statement in the subclass constructor.

c)

It must be the first Java statement in the subclass constructor.

d)

It is optional when a default constructor exists in the superclass.

26.

In the presence of a parameterized constructor in the superclass, which additional option allows subclasses to avoid explicitly calling super(...)?

a)

Superclass provides a no-arg constructor

b)

Subclass provides a static method

c)

Subclass marks its constructor private

d)

Superclass is declared final

27.

What is the primary purpose of using super(...) within a subclass constructor?

a)

To call another constructor in the same class

b)

To initialize subclass fields

c)

To initialize the superclass part of the object

d)

To import methods from the superclass

28.

Choose the correct execution order when both superclass and subclass define constructors and the subclass calls super(...).

a)

Subclass constructor body executes, then superclass constructor.

b)

Superclass constructor executes first, then subclass constructor body.

c)

Order is undefined and depends on the JVM.

d)

Both execute simultaneously.

29.

Which keyword directly references the current object’s superclass in Java?

a)

this

b)

super

c)

extends

d)

implements

30.

A subclass has no constructor defined. The superclass has a public no-arg constructor. What happens on instantiation of the subclass?

a)

Compilation error due to missing subclass constructor

b)

Superclass constructor is automatically called first

c)

No constructors are called

d)

Subclass constructor is synthesized and runs before the superclass

31.

Which rule applies when designing subclass constructors if the superclass provides only parameterized constructors?

a)

Subclasses may omit constructors; the compiler will add a default that calls super()

b)

Subclasses must define a constructor and call a superclass constructor using super(...)

c)

Subclasses must define a default constructor only

d)

Subclasses cannot be instantiated

32.

Which constructor executes first in a class inheritance hierarchy when creating a subclass object?

a)

The subclass constructor

b)

The superclass constructor

c)

The most recently defined constructor

d)

The constructor with the most parameters

33.

In Java, where are you allowed to write a super statement that calls a superclass constructor?

a)

In any method of the subclass

b)

Only in the subclass’s constructor

c)

In the superclass’s methods

d)

In static initialization blocks

34.

If a super statement appears in a subclass constructor, what is its required position?

a)

It can be anywhere after variable declarations

b)

It must be the last statement

c)

It must be the first statement

d)

It must follow a call to this()

35.

What happens if a subclass constructor does not explicitly call a superclass constructor in Java?

a)

Compilation fails immediately

b)

Java automatically calls super() before the subclass constructor code executes

c)

The subclass constructor runs without any superclass constructor

d)

A runtime exception is thrown

36.

A superclass lacks both a default constructor and a no-arg constructor. What must a subclass that inherits from it do?

a)

Nothing; Java inserts a default constructor for the superclass

b)

Declare a no-arg constructor in the subclass

c)

Explicitly call one of the existing constructors that the superclass does have

d)

Use this() to avoid calling the superclass

37.

Which statement best describes the rule about calling a superclass constructor from methods other than the subclass constructor?

a)

It is allowed using super anywhere

b)

It is allowed only in static methods

c)

It is not allowed; the superclass constructor cannot be called from any other method

d)

It is allowed if the method is private

38.

Consider a subclass constructor that begins with some logging statements and then calls super(). Which outcome aligns with Java’s constructor rules?

a)

Compiles and runs; order of statements is flexible

b)

Compiles but throws an exception at runtime

c)

Fails to compile because super() must be the first statement

d)

Runs but ignores the logging statements

39.

In object-oriented programming, what is the term for a subclass providing its own version of a superclass method with the same signature?

a)

Method overloading

b)

Method overriding

c)

Method hiding

d)

Method binding

40.

Which statement best explains why a subclass might override a superclass method?

a)

To ensure the superclass method is always called first

b)

Because the subclass is more specialized and may need a more suitable method

c)

To change the method name for readability

d)

To avoid using inheritance

41.

When overriding, what must match between the subclass method and the superclass method?

a)

Method name only

b)

Return type only

c)

Method signature

d)

Access modifier only

42.

What happens when an object of the subclass invokes an overridden method?

a)

The superclass’s version is executed

b)

Both versions execute sequentially

c)

The subclass’s version is executed

d)

A runtime error occurs

43.

Which phrase from the material defines method overriding?

a)

A subclass defines additional methods

b)

A subclass may have a method with the same signature as a superclass method

c)

A superclass calls a subclass method

d)

A subclass duplicates a field

44.

Select the true statement about overriding from the material.

a)

Overriding requires changing the parameter list

b)

Overriding is possible only if the subclass removes the method from the superclass

c)

Overriding uses the same signature as the superclass method

d)

Overriding always changes the return type

45.

Why might a subclass replace an inadequate superclass method?

a)

To eliminate polymorphism

b)

To provide a more suitable implementation for the specialized subclass

c)

To prevent objects from invoking methods

d)

To force compilation-time binding

46.

According to the material, which version of an overridden method does a subclass object use?

a)

Superclass’s version

b)

Subclass’s version

c)

Either version randomly

d)

A default library version

47.

Which pair correctly matches method name and return type shown for GradedActivity?

a)

getGrade(): double

b)

getScore(): char

c)

setScore(double): void

d)

CurvedActivity(percent: double): void

48.

In the CurvedActivity class, which member listed is a constructor?

a)

getRawScore(): double

b)

getPercentage(): double

c)

setScore(s: double): void

d)

CurvedActivity(percent: double)

49.

Which keyword allows a subclass method to call the overridden superclass method?

a)

this

b)

super

c)

extends

d)

parent

50.

Which statement correctly distinguishes overloading from overriding?

a)

Overloading requires the same signature; overriding requires different signatures

b)

Overloading uses different signatures for methods with the same name; overriding uses the same signature

c)

Overloading happens only across classes; overriding happens only within a class

d)

Overloading and overriding are identical concepts

51.

When a method overrides another method, how do their signatures compare?

a)

They must be different

b)

They must be the same

c)

They can be either the same or different

d)

They must be private

52.

Which scenario is valid for method overriding based on the material?

a)

Between unrelated classes without inheritance

b)

Only within an inheritance relationship

c)

Within a single class with no inheritance

d)

Across packages regardless of class relationships

53.

Which statement about overloading and overriding in inheritance relationships is accurate?

a)

Only overloading can occur in an inheritance relationship

b)

Neither overloading nor overriding can occur in inheritance

c)

Both overloading and overriding can take place in an inheritance relationship

d)

Overloading requires inheritance while overriding does not

54.

Choose the best description of method overloading.

a)

A subclass provides a new implementation with the same signature as a superclass method

b)

Multiple methods share the same name but have different signatures

c)

A method hides a variable from a superclass

d)

A method is called using the super keyword

55.

In Java, which access specifier allows access to class members from subclasses and from classes in the same package?

a)

private

b)

public

c)

protected

d)

default (package-private)

56.

Protected access for a member is best described as being _______.

a)

more restrictive than private

b)

less restrictive than public but more than private

c)

identical to default (package) access

d)

accessible only outside the package

57.

Which statement about protected members is TRUE?

a)

They cannot be accessed by subclasses.

b)

They can be accessed by any class, regardless of package.

c)

They can be accessed by subclasses and by classes in the same package.

d)

They are only accessible within the defining class.

58.

Using protected instead of private makes some tasks easier because _______.

a)

it blocks access from subclasses

b)

subclasses and same-package classes have unrestricted access

c)

it automatically generates public getters

d)

it prevents package access

59.

According to the guidance, what is generally recommended for fields?

a)

Declare fields as protected to simplify inheritance.

b)

Declare fields as public for maximum accessibility.

c)

Make all fields private and provide public methods to access them.

d)

Use default access for fields to avoid verbosity.

60.

If no access specifier is provided for a class member in Java, what access level is applied by default?

a)

private

b)

public

c)

protected

d)

package access (default)

61.

Which statement correctly explains package access in the context of protected members?

a)

Only subclasses in different packages can access the member.

b)

Any method in the same package may access the member.

c)

Only the defining class can access the member.

d)

Access is restricted to public methods only.

62.

Which access modifier allows a member to be accessed by subclasses and all other classes inside the same package, but not by classes outside the package (except subclasses)?

a)

default (no modifier)

b)

public

c)

protected

d)

private

63.

Which access modifier makes a member accessible to all classes everywhere (both inside and outside the package)?

a)

public

b)

protected

c)

default (no modifier)

d)

private

64.

A class member should be hidden from all other classes, including subclasses, regardless of package. Which modifier fits this requirement?

a)

protected

b)

default (no modifier)

c)

public

d)

private

65.

Which statement best describes default (no modifier) access?

a)

Accessible to subclasses outside the package only

b)

Accessible to all classes inside the same package but not outside the package

c)

Accessible to all classes everywhere

d)

Not accessible to any class

66.

You have a subclass in a different package that needs to access a superclass member. Which single modifier enables this access while still restricting access from non-subclass classes outside the package?

a)

default (no modifier)

b)

public

c)

protected

d)

private

67.

Which statement best defines a class hierarchy in Java?

a)

A graphical depiction of how variables are stored in memory

b)

A diagram showing inheritance relationships between classes

c)

A list of all methods available in a class

d)

A runtime stack trace of method calls

68.

In the illustrated hierarchy, which class is the direct superclass of PassFailExam?

a)

Object

b)

GradedActivity

c)

PassFailActivity

d)

FinalExam

69.

What is the role of the Object class in Java?

a)

It is the root class from which all Java classes are directly or indirectly derived

b)

It only provides support for graphical user interfaces

c)

It is a utility class used for mathematical operations

d)

It is a package that contains primitive types

70.

If a class does not specify the extends keyword, from which class is it automatically derived?

a)

String

b)

System

c)

Object

d)

Runtime

71.

Consider the snippet: "public class MyClass { /* no extends */ }". What is true about MyClass?

a)

It is not a valid Java class

b)

It automatically extends Object

c)

It extends String by default

d)

It cannot use methods from java.lang

72.

Which method is used to compare two objects for logical equality?

a)

compareTo()

b)

equals()

c)

toString()

d)

notify()

73.

In the chain shown for PassFailExam, what is the correct top-to-bottom order of classes?

a)

PassFailExam → PassFailActivity → GradedActivity → Object

b)

Object → GradedActivity → PassFailActivity → PassFailExam

c)

Object → PassFailActivity → GradedActivity → PassFailExam

d)

GradedActivity → Object → PassFailActivity → PassFailExam

74.

Which statement accurately describes inheritance as shown in the diagrams?

a)

Subclasses inherit from their parents, forming chains that lead back to Object

b)

Each class in Java must inherit from exactly two superclasses

c)

Inheritance only applies to methods, not fields

d)

FinalExam inherits from PassFailExam in the diagram

75.

Which conclusion can be drawn about PassFailExam from the chain of inheritance shown?

a)

It cannot use any methods from Object

b)

It inherits members from Object through its superclasses

c)

It directly extends Object

d)

It is unrelated to GradedActivity