nerdexam
Python_Institute

PCPP-32-101 · Question #13

What is true about type in the object-oriented programming sense?

The correct answer is C. It is the topmost type that any class can inherit from. In Python, type is the built-in metaclass that serves as the base class for all new-style classes. All new-style classes in Python, including built-in types like int and str, are instances of the type metaclass and inherit from it.

Advanced OOP

Question

What is true about type in the object-oriented programming sense?

Options

  • AIt is the bottommost type that any object can inherit from.
  • BIt is a built-in method that allows enumeration of composite objects
  • CIt is the topmost type that any class can inherit from.
  • DIt is an object used to instantiate a class.

How the community answered

(24 responses)
  • A
    4% (1)
  • C
    96% (23)

Explanation

In Python, type is the built-in metaclass that serves as the base class for all new-style classes. All new-style classes in Python, including built-in types like int and str, are instances of the type metaclass and inherit from it.

Topics

#type metaclass#class hierarchy#object model#inheritance

Community Discussion

No community discussion yet for this question.

Full PCPP-32-101 Practice