100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

PRG 421 Java Programming II - Finals Mock Exam Review - UOPX 2025

Rating
-
Sold
-
Pages
33
Uploaded on
28-05-2025
Written in
2024/2025

PRG 421 Java Programming II - Finals Mock Exam Review - UOPX 2025PRG 421 Java Programming II - Finals Mock Exam Review - UOPX 2025PRG 421 Java Programming II - Finals Mock Exam Review - UOPX 2025












Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
May 28, 2025
Number of pages
33
Written in
2024/2025
Type
Exam (elaborations)
Contains
Unknown

Subjects

Content preview

PRG 421 Java Programming II

Finals Mock Exam Review

(Questions & Solutions)

2025




©2025

, Question 1:
In Java, when using the `volatile` keyword, which property is primarily
guaranteed?
- A. Atomicity of compound actions
- B. Visibility of changes across threads
- C. Immunity from deadlocks
- D. Synchronization of method execution

ANS: B. Visibility of changes across threads
Rationale: The `volatile` keyword in Java ensures that a variable’s
changes are visible to all threads immediately. It does not provide
atomicity for compound operations (for which synchronization is
required) nor does it guarantee mutual exclusion or deadlock avoidance.

---

Question 2:
A developer uses an `ExecutorService` to manage concurrent tasks.
Which method call should be used to initiate an orderly shutdown where
previously submitted tasks are executed, but no new tasks are accepted?
- A. shutdownNow()
- B. halt()
- C. terminate()
- D. shutdown()

ANS: D. shutdown()
Rationale: The `shutdown()` method initiates an orderly shutdown by
ceasing acceptance of new tasks while allowing already submitted tasks
to complete. In contrast, `shutdownNow()` attempts to halt all executing
tasks abruptly.

---
©2025

, Question 3:
Which feature introduced in Java 8 allows for concise expression of
single-method interfaces and enables functional programming
techniques?
- A. Annotations
- B. Lambda expressions
- C. Generics
- D. Enumeration

ANS: B. Lambda expressions
Rationale: Lambda expressions, introduced in Java 8, allow you to
implement functional interfaces concisely and enable operations on
streams, greatly simplifying the coding of function objects.

---

Question 4:
In Java generics, what concept explains why generic type information is
not preserved at runtime?
- A. Type encapsulation
- B. Type induction
- C. Type erasure
- D. Type reflection

ANS: C. Type erasure
Rationale: Type erasure is the process by which Java’s compiler
removes generic type information during compilation. This means that
generic types are replaced with their upper bounds (often Object), and as
a result, the runtime does not retain explicit information about generic
parameters.

---

Question 5:
©2025

, Considering exception handling improvements in Java 7 and later, which
of the following constructs automatically closes resources when they are
no longer needed?
- A. try-catch-finally
- B. try-with-resources
- C. synchronized blocks
- D. catch-only statements

ANS: B. try-with-resources
Rationale: The try-with-resources statement ensures that resources
opened in the try block (which implement `AutoCloseable`) are
automatically closed at the end of the statement, even if exceptions
occur.

---

Question 6:
Which Java feature, introduced in Java 9, is designed to improve
modularity by allowing developers to define modules and control their
dependencies explicitly?
- A. Lambda expressions
- B. The Java Module System (Project Jigsaw)
- C. Enhanced for-loop
- D. Reflection API Extensions

ANS: B. The Java Module System (Project Jigsaw)
Rationale: The Java Module System, introduced in Java 9, provides a
framework for modularizing code, specifying module dependencies, and
encapsulating packages, thereby improving maintainability and security.

---

Question 7:
Which garbage collector, introduced in later versions of Java, is designed
for low pause times and high throughput by dividing the heap into
©2025

Get to know the seller

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.
MedGrad Walden University
View profile
Follow You need to be logged in order to follow users or courses
Sold
29
Member since
2 year
Number of followers
10
Documents
3344
Last sold
1 week ago

Hi there! I'm a former nursing student who loves to share my knowledge and help others succeed. On this account, you'll find my past study notes and papers for nursing and other programs that I've taken or reviewed. They are high-quality, well-organized and easy to understand. Whether you need a quick refresher, a detailed explanation or a sample essay, I've got you covered. Follow me and get access to the best resources for your studies. Trust me, you won't regret it!

Read more Read less
2.6

5 reviews

5
0
4
0
3
3
2
2
1
0

Recently viewed by you

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

Frequently asked questions