Courseiva
Working with Streams and Lambda ExpressionseasyMultiple ChoiceObjective-mapped

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

A lambda that takes a String and returns its length is assigned to which functional interface?

⚠ Common exam trap

Many candidates confuse `UnaryOperator` (which requires same input/output type) with `Function` (which allows different types), leading them to pick A instead of E.

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

Function<String, Integer>

The lambda `(String s) -> s.length()` takes a `String` input and returns an `Integer` (the length). This matches the `Function<T, R>` functional interface, which defines the abstract method `R apply(T t)`. Option E is correct because `Function<String, Integer>` exactly represents a function that accepts a `String` and produces an `Integer`.

Answer analysis

Option-by-option breakdown

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

  • UnaryOperator<String>

    Why it's wrong here

    UnaryOperator takes and returns the same type.

  • Consumer<String>

    Why it's wrong here

    Consumer takes a value and returns void.

  • Predicate<String>

    Why it's wrong here

    Predicate returns a boolean.

  • Supplier<Integer>

    Why it's wrong here

    Supplier takes no arguments and returns a value.

  • Function<String, Integer>

    Why this is correct

    Correct. This functional interface accepts a String and returns an Integer.

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.