Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam PCAP topic 1 question 66 discussion

Actual exam question from Python Institute's PCAP
Question #: 66
Topic #: 1
[All PCAP Questions]

If any of a class's components has a name that starts with two underscores (___), then:

  • A. the class component's name will be mangled
  • B. the class component has to be an instance variable
  • C. the class component has to be a class variable
  • D. the class component has to be a method
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
Reference:
https://hackernoon.com/understanding-the-underscore-of-python-309d1a029edc

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Adeshina
1 year, 4 months ago
A the double underscore (__) prefix is used to denote so-called "private" class members, i.e. class attributes or methods that are intended to be used only within the class or its subclasses, and should not be accessed directly from outside the class. When a class member is given a double underscore prefix, the interpreter automatically mangles the name of the member by adding a prefix and a suffix to it. This is done to prevent name clashes between class members with the same name but defined in different classes.
upvoted 4 times
...
Janpcap123
1 year, 9 months ago
Absolutely A is the answer.
upvoted 1 times
...
macxsz
1 year, 11 months ago
Selected Answer: A
A. the class component's name will be mangled
upvoted 1 times
...
AlMargoi
2 years ago
Selected Answer: A
I think answer is A
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...