CS – ITSW 3172 D286 Java Fundamentals
Complete Final Assessment (Qns & Ans)
2025
Question 1 (Multiple Choice)
Case:
A software engineer is designing a system that demonstrates
polymorphism. Consider a scenario where an object of a subclass
is assigned to a variable of its superclass type, and a method
overridden in the subclass is invoked.
Question:
Which mechanism ensures that the overridden subclass method is
called at runtime instead of the superclass version?
A. Static binding
B. Early binding
C. Dynamic binding
©2025
,D. Compile‑time binding
Correct ANS: C. Dynamic binding
Rationale:
Dynamic binding (or late binding) in Java ensures that the method
invoked is determined at runtime based on the actual object’s
class—even when referenced through a superclass variable. This
is a hallmark of polymorphism in Java.
---
Question 2 (Fill in the Blank)
Case:
When writing Java code, it is common to move seamlessly
between primitives and their corresponding wrapper types.
Statement:
The automatic conversion of a primitive type to its corresponding
wrapper class is known as ______.
Correct ANS: autoboxing
©2025
, Rationale:
Autoboxing is the process in Java by which the compiler
automatically converts a primitive type (e.g., `int`) into its
corresponding wrapper object (e.g., `Integer`), facilitating
operations in generic collections and other object-requiring
contexts.
---
Question 3 (True/False)
Case:
A development team is debating the use of multiple inheritance in
Java for a new project.
Statement:
Java supports multiple inheritance of classes, allowing a class to
extend more than one superclass.
Correct ANS: False
Rationale:
©2025
, Java does not support multiple inheritance of classes to prevent
the diamond problem. Instead, Java allows a class to implement
multiple interfaces, which provides a workaround for achieving
multiple inheritance of behavior.
---
Question 4 (Multiple Response)
Case:
An engineering team is reviewing the new features introduced
with Java 8 to modernize an existing codebase.
Question:
Which of the following features were introduced in Java 8?
(Select all that apply.)
A. Lambda expressions
B. Streams API
C. Generics
D. Default methods in interfaces
E. Annotations
Correct ANSs: A, B, D
©2025
Complete Final Assessment (Qns & Ans)
2025
Question 1 (Multiple Choice)
Case:
A software engineer is designing a system that demonstrates
polymorphism. Consider a scenario where an object of a subclass
is assigned to a variable of its superclass type, and a method
overridden in the subclass is invoked.
Question:
Which mechanism ensures that the overridden subclass method is
called at runtime instead of the superclass version?
A. Static binding
B. Early binding
C. Dynamic binding
©2025
,D. Compile‑time binding
Correct ANS: C. Dynamic binding
Rationale:
Dynamic binding (or late binding) in Java ensures that the method
invoked is determined at runtime based on the actual object’s
class—even when referenced through a superclass variable. This
is a hallmark of polymorphism in Java.
---
Question 2 (Fill in the Blank)
Case:
When writing Java code, it is common to move seamlessly
between primitives and their corresponding wrapper types.
Statement:
The automatic conversion of a primitive type to its corresponding
wrapper class is known as ______.
Correct ANS: autoboxing
©2025
, Rationale:
Autoboxing is the process in Java by which the compiler
automatically converts a primitive type (e.g., `int`) into its
corresponding wrapper object (e.g., `Integer`), facilitating
operations in generic collections and other object-requiring
contexts.
---
Question 3 (True/False)
Case:
A development team is debating the use of multiple inheritance in
Java for a new project.
Statement:
Java supports multiple inheritance of classes, allowing a class to
extend more than one superclass.
Correct ANS: False
Rationale:
©2025
, Java does not support multiple inheritance of classes to prevent
the diamond problem. Instead, Java allows a class to implement
multiple interfaces, which provides a workaround for achieving
multiple inheritance of behavior.
---
Question 4 (Multiple Response)
Case:
An engineering team is reviewing the new features introduced
with Java 8 to modernize an existing codebase.
Question:
Which of the following features were introduced in Java 8?
(Select all that apply.)
A. Lambda expressions
B. Streams API
C. Generics
D. Default methods in interfaces
E. Annotations
Correct ANSs: A, B, D
©2025