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 96 discussion

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

Assuming that the code below has been placed inside a file named code.py and executed successfully, which of the following expressions evaluate to True?
(Choose two.)

  • A. len(ClassB.__bases__) ==2
  • B. ClassA.__module__ == '__main__'
  • C. __name__ == 'code.py'
  • D. str(Object) == 'Object'
Show Suggested Answer Hide Answer
Suggested Answer: BD 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
dicksonpwc
1 year ago
Ans A,as len(ClassB.__bases__) =1,after compiled ,it show '1'. Ans B, as ClassA.__module__ == '__main__', after compiled, it return true. Ans C, __name__ = __main__, so __name__ != 'code.py', return is false. Ans D, (str(Object) == 'Object',after compiled , it show 'TypeError' Correction: if you add a comma at the front and the end of the "Object" word, after compiled, it will return true print(str('Object') == 'Object') # Ans D, return true Only B is correct Answer!!
upvoted 4 times
Damon54
2 months, 2 weeks ago
print(str('Object') == 'Object') out of context of the question
upvoted 1 times
...
...
andr3
1 year, 1 month ago
Selected Answer: B
Only B is valid str(Object) == "Object" Out[44]: False
upvoted 2 times
...
carpmatias
1 year, 11 months ago
Only B should be valid:
upvoted 3 times
...
macxsz
1 year, 11 months ago
Selected Answer: B
only: B. ClassA.__module__ == '__main__'
upvoted 1 times
...
Noarmy315
2 years, 3 months ago
A. False B. True C. False D. TypeError Should be B
upvoted 4 times
...
luckymuki
2 years, 6 months ago
The only expressions evaluating True is B
upvoted 2 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 ...