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 2 out of 8 pages
Exam (elaborations)

IS 5103 Quiz 10 | Questions and Answers | 2026 Update with complete solutions.

Document preview thumbnail
Preview 2 out of 8 pages

IS 5103 Quiz 10 | Questions and Answers | 2026 Update with complete solutions.

Content preview

Skip to content




 Home

 About us

 Quizzes

 Practice Tests

o

o

o

o

o



o



IS5103 Lesson-10

 Mark

 August 12, 2024

 IS5103

1.Which of the following throw an exception when an Optional is empty?
Each correct answer represents a complete solution. Choose all that apply.



This study source was downloaded by 100000903174213 from CourseHero.com on 01-12-2026 11:46:44 GMT -06:00


https://www.coursehero.com/file/250925558/Quiz-10docx/

, A) opt.orElseThrow();
opt.orElseThrow(RuntimeException::new);
opt.get();

2.Assume that the directory /animals exists and is empty. What is the
result of executing the following code?
Path path = Path.of(“/animals”);
try (var z = Files.walk(path)) {
boolean b = z
.filter((p,a) -> a.isDirectory() && !path.equals(p)) // x
.findFirst().isPresent(); // y
System.out.print(b ? “No Sub”: “Has Sub”);
}
A) The code will not compile because of line x.

3.What could be the output of the following code snippet?
var stream = Stream.iterate(“”, (s) -> s + “1”);
System.out.println(stream.limit(2).map(x -> x + “2”));
A) java.util.stream.ReferencePipeline$3@4517d9a3

4.What could be the output of the following?
Predicate <String>predicate = s -> s.startsWith(“g”);
var stream1 = Stream.generate(() -> “growl!”);
var stream2 = Stream.generate(() -> “growl!”);
var b1 = stream1.anyMatch(predicate);
var b2 = stream2.allMatch(predicate);
System.out.println(b1 + ” ” + b2);
A) The code hangs.

5.What could be the output of the following?
Predicate predicate = s -> s.length()> 3;
var stream = Stream.iterate(“-“,
s -> ! s.isEmpty(), (s) -> s + s);
var b1 = stream.noneMatch(predicate);
var b2 = stream.anyMatch(predicate);
System.out.println(b1 + ” ” + b2);
A) An exception is thrown

6.Which are true statements about terminal operations in a stream that
runs successfully?
Each correct answer represents a complete solution. Choose all that
apply



This study source was downloaded by 100000903174213 from CourseHero.com on 01-12-2026 11:46:44 GMT -06:00


https://www.coursehero.com/file/250925558/Quiz-10docx/

Document information

Uploaded on
January 12, 2026
Number of pages
8
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$16.99

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.
Wiseman
3.9
(1639)
Sold
8170
Followers
3893
Items
30517
Last sold
1 hour 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