Solved

Consider the Following Code Which Would Set the Hour of a Time

Question 33

Multiple Choice

Consider the following code which would set the hour of a Time object to an invalid value. wake_up._hour = 100
Which of the following statements is false?


A) Rather than _hour, we can name the attribute __hour with two leading underscores. This convention indicates that __hour is "private" and should not be accessible to the class's xe "client of a class"clients.
B) To help prevent clients from accessing "private" attributes, Python renames them by preceding the attribute name with _ClassName, as in _Time__hour. This is called xe "name mangling"name mangling.
C) If you try to assign to __hour, as in
Wake_up.__hour = 100
Python raises a ValueError, indicating that the class does not have an __hour attribute.
D) IPython does not show attributes with one or two leading underscores when you try to auto-complete an expression like
Wake_up.
By pressing Tab. Only attributes that are part of the wake_up object's "public" interface are displayed in the IPython auto-completion list.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents