Which built-in function is used to check whether an object belongs to a particular class or its subclass?

Options

  • A. typecheck()
  • B. isinstance()
  • C. classof()
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. isinstance()

Detailed Explanation

The isinstance() function checks whether an object is an instance of a specified class or a subclass of that class.