1Z0-829 Working with Streams and Lambda Expressions Practice Question
Which TWO of the following are characteristics of a well-designed lambda expression? (Choose two.)
⚠ Common exam trap
Oracle often tests the misconception that shadowing or modifying local variables is acceptable in lambdas, but the exam specifically requires understanding that only effectively final variables can be captured and that stateful lambdas are discouraged in well-designed code.
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
✓
Is stateless
A well-designed lambda expression should be stateless, meaning it does not depend on or modify mutable state from the enclosing scope. This ensures that the lambda can be safely executed in parallel streams without race conditions or side effects, aligning with the functional programming paradigm promoted by Java streams.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Is stateless
Why this is correct
Stateless lambdas are safer, especially in parallel streams, as they avoid race conditions.
- ✗
Throws exceptions that are not declared in the functional interface's abstract method
Why it's wrong here
Checked exceptions must be handled; throwing undeclared checked exceptions is not allowed.
- ✗
Uses the same variable name as a parameter in the enclosing scope (shadowing)
Why it's wrong here
Shadowing reduces readability and is not a recommended practice.
- ✓
Uses only effectively final variables from the enclosing scope
Why this is correct
Using effectively final variables ensures the lambda is not stateful and avoids unexpected behavior.
- ✗
Modifies local variables of the enclosing method
Why it's wrong here
Local variables used in lambdas must be effectively final; modification is not allowed.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
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 →
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.