Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 104 pages
Exam (elaborations)

IT 212 Object-Oriented Programming Final Exam Prep: 190 Java Questions & Answers (Latest 2026/2027)

Document preview thumbnail
Preview 4 out of 104 pages

Master your coding exam with this comprehensive IT 212 Object-Oriented Programming study guide featuring 190 verified questions and detailed solutions. It provides extensive coverage of core Java development principles, including inheritance, polymorphism, encapsulation, and abstraction. Designed for thorough final review, these up-to-date practice questions and code breakdowns will ensure you fully understand OOP design patterns and pass your exam with confidence.

Content preview

IT 212 Object-Oriented Programming Comprehensive Final
Exam Practice Questions and Detailed Solutions Latest Update
2026/2027 | Java Development, Inheritance, Polymorphism,
Verified Answers - 190 Questions

This comprehensive final exam assesses advanced proficiency in Java object-oriented programming, covering
inheritance hierarchies, polymorphism, encapsulation, design patterns, generics, exception handling, and
functional programming. Questions require deep conceptual reasoning, code analysis, and application to novel
scenarios. It contains 190 multiple-choice questions, each with four distractors and a fully worked rationale that
explains why the keyed answer is correct. Questions are organized into clearly labelled sections that mirror the
major content areas of the course. Targeted learning outcomes include: Analyze and design complex inheritance
hierarchies with proper use of abstract classes and interfaces.; Evaluate polymorphic behavior and dynamic
dispatch in multi-level class structures.; Apply design patterns and generics to solve architectural problems.;
Critique exception handling strategies and concurrency control in Java.. Every item has been reviewed for
clinical accuracy, current guidelines, and clarity so that students can study with confidence and self-correct as
they work through the bank. Use it as a high-yield review immediately before the exam, or as a structured practice
tool during the unit - the rationales double as concise teaching notes. The recommended writing time is 3 hours,
with a passing score of 70%. Aligned with Aligned with ACM/IEEE CS curricula and ABET accreditation
standards for computing programs. standards and reflects the question style commonly seen on accredited
program examinations. Students consistently achieving above the cut score on this bank have historically gone on

Section 1: General (Questions 1-190)

1 Given the following classes: class A { void m() {
System.out.print("A"); } } class B extends A { void m() {
System.out.print("B"); } } class C extends B { void m() {
System.out.print("C"); } } What is the output when executing: A a =
new C(); a.m();?
A) A
B) B
C) C
D) Compilation error
Answer: C
Rationale: Dynamic dispatch selects the most derived override at
runtime. Since the object is of type C, C.m() is invoked, printing "C".
The reference type A does not affect method resolution.
2 Which statement about Java's default methods in interfaces is
correct?

,A) They can be overridden only in abstract classes.
B) They allow interfaces to have state via instance fields.
C) They provide a default implementation that can be overridden by
implementing classes.
D) They must be final to prevent ambiguity.
Answer: C
Rationale: Default methods were introduced in Java 8 to allow
interface evolution without breaking existing implementations. They
provide a default behavior that classes can optionally override. They
cannot have state (fields), and they are not required to be final.
3 In the context of the SOLID principles, which design principle is
violated by a class that directly instantiates concrete dependencies in
its constructor?
A) Open/Closed Principle
B) Liskov Substitution Principle
C) Interface Segregation Principle
D) Dependency Inversion Principle
Answer: D
Rationale: Direct instantiation of concrete dependencies couples the
class to specific implementations, violating the Dependency Inversion
Principle which states that high-level modules should not depend on
low-level modules but on abstractions. This reduces flexibility and
testability.
4 Consider the following code snippet: List<? extends Number> list =
new ArrayList<Integer>(); list.add(42); Which statement is correct?
A) Compiles and adds 42 to the list.
B) Compiles but throws ClassCastException at runtime.
C) Fails to compile because add() is not allowed on a wildcard type.
D) Fails to compile because Integer is not a subtype of Number.
Answer: C

,Rationale: A wildcard with an upper bound (? extends Number) means
the actual type is unknown (could be Integer, Double, etc.), so the
compiler disallows adding any element except null to prevent type
safety violations. Thus, list.add(42) does not compile.
5 Which of the following best describes the behavior of the
try-with-resources statement when both the try block and the close()
method throw exceptions?
A) The try block exception is suppressed, and the close() exception
is propagated.
B) The close() exception is suppressed, and the try block exception is
propagated.
C) Both exceptions are propagated as suppressed exceptions.
D) The first thrown exception (whether from try or close) is
propagated, and the other is added as suppressed.
Answer: D
Rationale: In try-with-resources, if the try block throws an exception,
that exception is propagated, and any exceptions from close() are
added as suppressed. If the try block completes normally, the close()
exception is propagated. This is the documented behavior.
6 Which design pattern would be most appropriate for creating a
family of related objects without specifying their concrete classes,
allowing the client to work with abstract types?
A) Singleton
B) Factory Method
C) Abstract Factory
D) Builder
Answer: C
Rationale: The Abstract Factory pattern provides an interface for
creating families of related objects without specifying their concrete
classes. Factory Method deals with a single product, while Builder
focuses on step-by-step construction. Abstract Factory is ideal for

, ensuring consistency among related products.
7 Given the following code: class Base { public void display() {
System.out.println("Base"); } } class Derived extends Base { public
void display() throws RuntimeException {
System.out.println("Derived"); } } What is the result?
A) Compilation error because the override cannot narrow the
exception type.
B) Compilation error because the override cannot change the access
modifier.
C) Compiles and prints "Derived" when called on a Derived object.
D) Compiles and prints "Base" when called on a Base reference to a
Derived object.
Answer: C
Rationale: An overriding method can throw a subclass of the exception
thrown by the parent method (or no exception). RuntimeException is a
subclass of Exception, but the parent method throws no checked
exception; however, unchecked exceptions are allowed. The override
is valid, and dynamic dispatch prints "Derived".
8 Which of the following statements about Java's Object class
methods is correct?
A) hashCode() and equals() are independent and can be overridden
without affecting each other.
B) The default equals() method uses reference equality, and
hashCode() returns the memory address.
C) If two objects are equal, they must have the same hashCode, but
unequal objects may have the same hashCode.
D) The toString() method is final and cannot be overridden.
Answer: C
Rationale: The contract between equals() and hashCode() states that
equal objects must have the same hash code, but unequal objects may
have the same hash code (collisions). The default equals() uses

Document information

Uploaded on
August 24, 2026
Number of pages
104
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$28.79

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
StudentArchive
3.9
(7)
Sold
33
Followers
1
Items
1356
Last sold
4 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions