Bird
0
0

Which of the following is the correct way to define a method named borrowBook inside the Member class in Python?

easy🧠 Conceptual Q12 of 15
LLD - Design — Library Management System
Which of the following is the correct way to define a method named borrowBook inside the Member class in Python?
Adef borrowBook():
Bdef borrowBook(book):
Cdef borrowBook(self):
Ddef borrowBook(self, book):
Step-by-Step Solution
Solution:
  1. Step 1: Understand method definition in Python classes

    Instance methods must have self as the first parameter to access object data.
  2. Step 2: Check method parameters for borrowing a book

    The method needs the book to borrow, so it should accept a book parameter after self.
  3. Final Answer:

    def borrowBook(self, book): -> Option D
  4. Quick Check:

    Instance method with self and book param [OK]
Quick Trick: Instance methods always start with self parameter [OK]
Common Mistakes:
MISTAKES
  • Omitting self parameter
  • Not passing book argument
  • Defining method without parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes