Bird
Raised Fist0

Which of the following is the correct way to call a method named greet on an object person?

easy📝 Syntax Q12 of Q15
Python - Methods and Behavior Definition
Which of the following is the correct way to call a method named greet on an object person?
Agreet.person()
Bperson.greet()
Cperson->greet()
Dgreet(person)
Step-by-Step Solution
Solution:
  1. Step 1: Recall Python method call syntax

    In Python, to call a method on an object, use dot notation: object.method()
  2. Step 2: Check each option

    person.greet() uses correct dot notation with parentheses. Others use invalid syntax or function call style.
  3. Final Answer:

    person.greet() -> Option B
  4. Quick Check:

    Object.method() is correct call syntax [OK]
Quick Trick: Remember: object.method() calls a method in Python [OK]
Common Mistakes:
MISTAKES
  • Using arrow (->) like other languages
  • Reversing object and method order
  • Calling method without parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes