Courseiva
Working with Streams and Lambda ExpressionsmediumMultiple ChoiceObjective-mapped

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

A team implements a stream pipeline that processes a large dataset in parallel. They use a stateful lambda expression inside the map operation to maintain a count. What is the most likely outcome?

⚠ Common exam trap

Many candidates assume synchronization or thread-safety fixes the issue, but the Streams API's contract requires stateless lambdas for correctness in parallel pipelines, and synchronization does not restore deterministic behavior or guarantee correct results.

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 will produce non-deterministic results due to race conditions.

Using a stateful lambda (one that mutates shared mutable state) inside a parallel stream's map operation introduces race conditions. The map operation is intended to be stateless and non-interfering; when multiple threads concurrently update a shared counter without proper synchronization, the result becomes non-deterministic and unpredictable.

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 pipeline will produce correct results if the stateful lambda is synchronized.

    Why it's wrong here

    Synchronization can cause contention and degrade performance, but it may work; however, it is not a recommended approach and may still have ordering issues.

  • The pipeline will produce non-deterministic results due to race conditions.

    Why this is correct

    Stateful lambdas in parallel streams are discouraged because they introduce shared mutable state that leads to race conditions and unpredictable results.

  • The pipeline will throw a ConcurrentModificationException.

    Why it's wrong here

    ConcurrentModificationException occurs when the stream source is modified during iteration, not due to stateful lambda.

  • The pipeline will always produce the same result regardless of parallelism.

    Why it's wrong here

    Parallel stream processing with stateful lambda is inherently non-deterministic.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

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.