Bird
0
0

Analyze this Kafka auto-scaling snippet:

medium📝 Predict Output Q4 of 15
Kafka - Kubernetes and Cloud Deployment
Analyze this Kafka auto-scaling snippet:
cpu_load = 90
if (cpu_load >= 85) {
  add_broker()
  print("Scaling up")
} else {
  print("Stable")
}

What will be the output?
A"Stable"
B"Scaling up"
CNo output
DError due to syntax
Step-by-Step Solution
Solution:
  1. Step 1: Check condition

    cpu_load is 90, which is >= 85, so condition is true.
  2. Step 2: Determine executed block

    The if block runs: add_broker() and print("Scaling up").
  3. Final Answer:

    "Scaling up" -> Option B
  4. Quick Check:

    Condition true triggers "Scaling up" print [OK]
Quick Trick: Condition true triggers "Scaling up" print [OK]
Common Mistakes:
MISTAKES
  • Misreading the comparison operator
  • Assuming else block runs when condition is true
  • Thinking syntax error exists without evidence

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes