Bird
0
0

Identify the issue in this Kafka auto-scaling snippet:

medium📝 Debug Q7 of 15
Kafka - Kubernetes and Cloud Deployment
Identify the issue in this Kafka auto-scaling snippet:
if (cpu_usage > 80) {
  add_broker()
 else {
  remove_broker()
}
AMissing closing brace before else
BIncorrect comparison operator
CFunction names are invalid
DPercentage sign should be removed
Step-by-Step Solution
Solution:
  1. Step 1: Check block structure

    Each if block must close with a brace before else starts.
  2. Step 2: Identify missing brace

    The closing brace after add_broker() is missing before else.
  3. Final Answer:

    Missing closing brace before else -> Option A
  4. Quick Check:

    Braces must close before else [OK]
Quick Trick: Close braces before else block [OK]
Common Mistakes:
  • Missing braces
  • Confusing operators
  • Assuming % sign causes error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes