Bird
Raised Fist0

Which of the following is the correct syntax to apply a map operation on a Kafka stream named stream to convert messages to uppercase?

easy📝 Syntax Q12 of Q15
Kafka - Streams
Which of the following is the correct syntax to apply a map operation on a Kafka stream named stream to convert messages to uppercase?
Astream.map(value.toUpperCase)
Bstream.filter(value -> value.toUpperCase())
Cstream.map(value => value.toUpperCase())
Dstream.map(value -> value.toUpperCase())
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct lambda syntax in Kafka Streams

    Kafka Streams in Java uses map(value -> ...) syntax for mapping values.
  2. Step 2: Check method call correctness

    value.toUpperCase() correctly converts string to uppercase.
  3. Final Answer:

    stream.map(value -> value.toUpperCase()) -> Option D
  4. Quick Check:

    Correct lambda and method call = stream.map(value -> value.toUpperCase()) [OK]
Quick Trick: Use arrow -> for lambda in Kafka Streams Java [OK]
Common Mistakes:
MISTAKES
  • Using filter instead of map
  • Using JavaScript arrow => instead of Java ->
  • Missing parentheses in method call

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes