1Z0-829 Lambda parameter parentheses Practice Question
Which TWO are valid lambda expressions? (Choose two.) A. (int a, int b) -> a + b B. a, b -> a + b C. (a, b) -> a + b D. (a, b) -> { a + b; } E. (int a, b) -> a + b
⚠ Common exam trap
A common trap is assuming that parentheses can be omitted for multiple parameters. In Java, lambda expressions with multiple parameters always require parentheses around the parameter list.
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
✓
(int a, int b) -> a + b
Options A and C are valid lambda expressions. Option A uses explicit parameter types, which is allowed in lambda expressions. Option C uses inferred types with parentheses, also valid. Option B is invalid because multiple lambda parameters require parentheses. Option D is invalid because the block body does not contain a return statement, and the expression statement a + b; is not a valid return statement. Option E is invalid because it mixes explicit and inferred parameter types; if one parameter has an explicit type, all must have explicit types.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
(int a, int b) -> a + b
Why this is correct
Valid: explicit types are allowed in lambda parameter lists.
- ✗
a, b -> a + b
Why it's wrong here
Invalid: multiple parameters require parentheses.
- ✓
(a, b) -> a + b
Why this is correct
Valid: inferred types with parentheses.
- ✗
(a, b) -> { a + b; }
Why it's wrong here
Invalid: block body needs a return statement, or must be a void-compatible block; a + b; is an expression statement, not a return.
- ✗
(int a, b) -> a + b
Why it's wrong here
Invalid: mixed explicit and inferred types.
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.