Bird
0
0

What is wrong with this pseudocode for an AGI agent's safety check?

medium📝 Debug Q7 of 15
Agentic AI - Future of AI Agents
What is wrong with this pseudocode for an AGI agent's safety check?
if agent.risk_level > 5:
    agent.execute_task()
else:
    print("Unsafe to proceed")
ASafety check should prevent execution if level is too low, not high
BComparison operator should be '<' instead of '>'
CNo else block needed
Dagent.execute_task() should be outside the if statement
Step-by-Step Solution
Solution:
  1. Step 1: Understand risk level meaning

    Higher risk levels mean unsafe; agent should execute only if risk_level is low enough (< 5).
  2. Step 2: Check comparison operator

    The code uses '>' which executes when risk_level > 5 (unsafe high risk). It should use '<' instead.
  3. Final Answer:

    Comparison operator should be '<' instead of '>' -> Option B
  4. Quick Check:

    Safety check operator = '<' [OK]
Quick Trick: Check if safety means risk or protection [OK]
Common Mistakes:
  • Confusing '>' and '<'
  • Ignoring else block
  • Misplacing execute_task call

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes