Bird
0
0

What will be the output of the following code snippet in Lambda architecture?

medium📝 Predict Output Q5 of 15
Hadoop - Modern Data Architecture with Hadoop
What will be the output of the following code snippet in Lambda architecture?
def speed_process(stream):
    return [x*2 for x in stream if x > 5]

result = speed_process([3, 7, 10])
print(result)
A[]
B[6, 14, 20]
C[3, 7, 10]
D[14, 20]
Step-by-Step Solution
Solution:
  1. Step 1: Understand list comprehension filtering

    Only numbers greater than 5 are processed: 7 and 10.
  2. Step 2: Calculate doubled values

    7*2=14, 10*2=20, so output is [14, 20].
  3. Final Answer:

    [14, 20] -> Option D
  4. Quick Check:

    Filtered doubled values = [14, 20] [OK]
Quick Trick: Filter then double values > 5 [OK]
Common Mistakes:
  • Including numbers <= 5
  • Not doubling values
  • Returning original list

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Hadoop Quizzes