Bird
0
0

What is wrong with this code for tracking agent status?

medium📝 Debug Q7 of 15
Agentic AI - Agent Observability
What is wrong with this code for tracking agent status?
status = None
if status:
    print("Agent active")
else:
    print("Agent inactive")
ASyntax error in if statement
Bstatus is None, so condition is True; prints 'Agent active'
Cstatus is None, so condition is False; prints 'Agent inactive'
DCode will crash due to NoneType
Step-by-Step Solution
Solution:
  1. Step 1: Understand truthiness of None in Python

    None is treated as False in conditions.
  2. Step 2: Predict output based on condition

    Since status is None, the else branch runs, printing 'Agent inactive'.
  3. Final Answer:

    status is None, so condition is False; prints 'Agent inactive' -> Option C
  4. Quick Check:

    None is False in if conditions [OK]
Quick Trick: None is False in conditions; check before using [OK]
Common Mistakes:
  • Assuming None is True
  • Expecting syntax error
  • Thinking code crashes on None

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes