Courseiva
Working with Streams and Lambda ExpressionsmediumMultiple ChoiceObjective-mapped

1Z0-829 Working with Streams and Lambda Expressions Practice Question

A developer adds .peek(System.out::println) to a stream pipeline to debug, but no output is printed. What is the most likely reason?

⚠ Common exam trap

Test-takers frequently assume intermediate operations execute eagerly or that peek() works like a standalone print statement, overlooking the fundamental lazy-evaluation contract of streams.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The pipeline lacks a terminal operation

Stream pipelines are lazy; intermediate operations like peek() are only executed when a terminal operation (e.g., forEach, collect, reduce) is invoked. Without a terminal operation, the pipeline never starts processing data, so peek() produces no output.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The stream is parallel

    Why it's wrong here

    Parallel streams still execute; the issue is not parallelism.

  • The pipeline lacks a terminal operation

    Why this is correct

    Correct. Without a terminal operation, the pipeline never executes, so peek never runs.

  • The peek operation is placed after the terminal operation

    Why it's wrong here

    Terminal operations end the pipeline; peek must be placed before the terminal operation.

  • The stream is empty

    Why it's wrong here

    Even if empty, peek would not execute, but the presence of a terminal operation would show that no elements are processed; however, the question states no output, so the pipeline is not executed at all.

About these practice questions

This 1Z0-829 question is part of Courseiva's 513-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.