ITSC 1213 Checkpoint 3

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/17

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:49 PM on 4/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

18 Terms

1
New cards

Decide whether an abstract class or an interface would be the better design choice.

Abstract class

2
New cards

Where should a call to the parent class's constructor be placed within a subclass constructor?

As the very first statement inside the subclass constructor.

3
New cards

How does the DRY (Don't Repeat Yourself) principle relate to inheritance in Java?

Inheritance reduces code duplication by allowing subclasses to reuse methods and attributes from a superclass.

4
New cards

What does the protected access modifier allow in Java?

Access within the same class, subclasses, and the same package.

5
New cards

Athlete

TeamMember

Student

StudentAthlete

→ interface
→ interface
→ superclass
→ subclass

6
New cards

In the context of inheritance, what would happen if a field in a superclass is private?

It can only be accessed within the superclass itself.

7
New cards

What happens if a class incorrectly implements an interface method by adding extra parameters or using a different return type?

The program will not compile because the method signature must exactly match the interface definition.

8
New cards

How does inheritance help reduce code duplication?

By allowing a superclass to share common code with multiple subclasses.

9
New cards

What is method overriding in Java?

Providing a new implementation of a method inherited from a parent class in the subclass.

10
New cards

Which of the following is true regarding abstract classes or abstract methods?

Abstract methods must be overriden.

Abstract classes only become useful in programs when they are extended.

11
New cards

You have this code in a method:

throw new NoSuchElementException("Not found");

Which statement best describes what happens immediately after the throw statement executes?

Execution of that method stops; Java looks for a matching catch block higher on the call stack. If none is found, the program terminates with a stack trace.

12
New cards

What is the primary purpose of an interface in Java?

To define a contract that multiple classes can implement.

13
New cards

Which statement best describes the difference between Java Error and Exception classes?

Error represents critical system-level failures (e.g., OutOfMemoryError) that are usually not handled, while Exception represents problems your code can potentially catch and recover from.

14
New cards

Why should you use the @Override annotation when implementing an abstract method?

It helps catch signature mismatches at compile time.

15
New cards

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

If the default (no-argument) constructor of the superclass exists it is automatically called otherwise the compiler throws an error.

16
New cards

What is one advantage of using an abstract class over an interface?

An abstract class can provide instance variables and concrete methods.

17
New cards

Why can any object in Java be assigned to a variable of type Object?

Because Object is the root superclass of all Java classes.

18
New cards

In Java, why might throwing an exception be preferable to returning a special "sentinel value" (like 999) when something goes wrong?

Exceptions force the caller to handle the error or let the program crash, preventing silent misuse of an invalid return value.