PCAP Exam QuestionsBrowse all questions from this exam

PCAP Exam - Question 103


A property that stores information about a given class's super-classes is named:

Show Answer
Correct Answer: D

The property that stores information about a given class's super-classes in Python is '__bases__'. This attribute is a tuple containing references to the base classes. Options like '__upper__', '__super__', and '__ancestors__' do not exist as properties in Python for this purpose.

Discussion

5 comments
Sign in to comment
macxszOption: D
Apr 29, 2022

D. __bases__ __ancestors__ does not exist

666_mOption: D
May 12, 2022

D is correct

MallieOption: D
Dec 22, 2022

Superclasses may be called ancestors, but there is no such property. Answer is D

BaldridgeOption: D
May 31, 2022

D is correct

seaverickOption: D
Jan 30, 2024

http://www.java2s.com/example/python-book/class-bases-attribute.html class rec: pass # Empty namespace object rec.name = 'Bob' # Just objects with attributes rec.age = 40 # ww w . ja v a2 s.c o m d = rec.__bases__ # Class to superclasses link, () in 2.X #d = rec.__ancestors__ #AttributeError: type object 'rec' has no attribute '__ancestors__' #d = rec.__super__ #AttributeError: type object 'rec' has no attribute '__super__' #d = rec.__upper__ #AttributeError: type object 'rec' has no attribute '__upper__' print( d ) ans D