Bird
0
0

Given this pseudocode for an AI tool permission check:

medium📝 Predict Output Q13 of 15
Agentic AI - Agent Safety and Guardrails
Given this pseudocode for an AI tool permission check:
def can_perform(action, permissions):
    return action in permissions['allowed'] and action not in permissions['denied']

permissions = {'allowed': ['read', 'write'], 'denied': ['delete']}
action = 'delete'
print(can_perform(action, permissions))

What will be the output?
ATrue
BFalse
CError
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Understand the function logic

    The function returns True only if action is in allowed and not in denied.
  2. Step 2: Check the action 'delete'

    'delete' is not in allowed but is in denied, so condition fails.
  3. Final Answer:

    False -> Option B
  4. Quick Check:

    Action denied = False output [OK]
Quick Trick: Check if action is both allowed and not denied for True [OK]
Common Mistakes:
  • Ignoring denied list and returning True
  • Assuming 'delete' is allowed by default
  • Confusing function return values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes