PCAP 31 03 PCAP Certified Associate Python Programmer · Free Practice Question Easy
Question 51
Q575 - Basics
The built-in class property called __bases__ is:
-
A
a tuple, which contains information about
the direct superclasses of the class.
-
B
a variable of type
int, which stores the radix currently used by the class. -
C
a dictionary, which contains information about
all the superclasses of the class.
-
D
a string, which contains information about
the direct superclasses of the class.
Reveal correct answer
Correct answer: A
Explanation
Topics: __bases__
Try it yourself:
- class A:
- pass
- class B(A):
- pass
- class C(A):
- pass
- class X(B, C):
- pass
- print(X.__bases__)
- # (<class '__main__.B'>, <class '__main__.C'>)
Explanation:
__bases__ is a tuple which contains the direct superclasses.
Q575 (Please refer to this number, if you want to write me about this question.)
A. The choice is correct. The __bases__ property in Python is a tuple that contains information about the direct superclasses of the class. It allows access to the class's immediate parent classes.
B. The choice is incorrect. The __bases__ property is not a variable of type int that stores the radix currently used by the class. It is a tuple that holds information about the direct superclasses of the class.
C. The choice is incorrect. The __bases__ property is not a dictionary but a tuple that specifically holds information about the direct superclasses of the class. It does not contain information about all the superclasses of the class.
D. The choice is incorrect. The __bases__ property is not a string but a tuple in Python. It does not contain information about the direct superclasses of the class.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
