Bird
0
0

This auto-scaling script snippet has an error:

medium📝 Debug Q14 of 15
Kafka - Kubernetes and Cloud Deployment
This auto-scaling script snippet has an error:
if cpu_usage > 70%:
  add_broker()
elif cpu_usage < 20%:
  remove_broker()
What is the error?
AIncorrect percentage symbol usage in condition
Badd_broker() function is undefined
CMissing colon after if statement
DNo error, code is correct
Step-by-Step Solution
Solution:
  1. Step 1: Analyze condition syntax

    Using '%' directly in conditions like 'cpu_usage > 70%' is invalid syntax in most languages.
  2. Step 2: Identify correct syntax

    Percent values should be numeric (e.g., 0.7 or 70) without '%' symbol in code.
  3. Final Answer:

    Incorrect percentage symbol usage in condition -> Option A
  4. Quick Check:

    Conditions must use numbers, not '%' symbol [OK]
Quick Trick: Don't use % symbol in code conditions, use numbers only [OK]
Common Mistakes:
MISTAKES
  • Assuming missing colon is the error
  • Thinking functions are undefined without context
  • Believing code is correct as is

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes