Bird
0
0

Given this pseudo-code for auto-scaling Kafka brokers:

medium📝 Predict Output Q13 of 15
Kafka - Kubernetes and Cloud Deployment
Given this pseudo-code for auto-scaling Kafka brokers:
if (cpu_usage > 80%) {
  add_broker()
} else if (cpu_usage < 30%) {
  remove_broker()
} else {
  do_nothing()
}
What happens if CPU usage is 85%?
AA broker is added
BNo change in brokers
CA broker is removed
DError occurs due to syntax
Step-by-Step Solution
Solution:
  1. Step 1: Check CPU usage condition

    CPU usage is 85%, which is greater than 80%.
  2. Step 2: Determine action based on condition

    Since cpu_usage > 80%, the code calls add_broker() to add a broker.
  3. Final Answer:

    A broker is added -> Option A
  4. Quick Check:

    CPU > 80% triggers add_broker() [OK]
Quick Trick: CPU > 80% means add broker, CPU < 30% means remove [OK]
Common Mistakes:
MISTAKES
  • Confusing add and remove actions
  • Ignoring else conditions
  • Assuming syntax error without cause

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes