Bird
0
0

What will be the output of this pseudo-code?

medium📝 Predict Output Q5 of 15
Agentic AI - Agent Safety and Guardrails
What will be the output of this pseudo-code?
confidence = 0.8
if confidence < 0.75:
    print('Needs human approval')
else:
    print('Approved automatically')
ANeeds human approval
BApproved automatically
CNo output
DRuntime error
Step-by-Step Solution
Solution:
  1. Step 1: Check the condition with confidence = 0.8

    0.8 < 0.75 is false, so the else block runs.
  2. Step 2: Identify printed output

    The else block prints 'Approved automatically'.
  3. Final Answer:

    Approved automatically -> Option B
  4. Quick Check:

    False condition triggers else output [OK]
Quick Trick: False if condition means else block runs [OK]
Common Mistakes:
  • Choosing if-block output when condition is false
  • Assuming no output if condition false
  • Confusing comparison operators

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes