Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q5 of 15
Agentic AI - Production Agent Architecture
What will be the output of this code?
class Agent:
    def send(self, message):
        return f"Sent: {message}"

agent = Agent()
print(agent.send('Data'))
AData
BSent: message
CSent: Data
DNone
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the send method return value

    The method returns a formatted string with 'Sent: ' plus the message argument.
  2. Step 2: Check the print statement output

    Printing the return value of send('Data') outputs 'Sent: Data'.
  3. Final Answer:

    Sent: Data -> Option C
  4. Quick Check:

    Return value printed matches formatted string [OK]
Quick Trick: Return formatted string, then print it to see output [OK]
Common Mistakes:
  • Expecting print inside send method
  • Confusing return value with parameter name
  • Assuming None is printed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes