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

Exam PCAP All Questions

View all questions & answers for the PCAP exam

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: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
dicksonpwc
1 year, 7 months 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
9 months, 3 weeks ago
print(str('Object') == 'Object') out of context of the question
upvoted 1 times
...
...
andr3
1 year, 8 months ago
Selected Answer: B
Only B is valid str(Object) == "Object" Out[44]: False
upvoted 2 times
...
carpmatias
2 years, 6 months ago
Only B should be valid:
upvoted 3 times
...
macxsz
2 years, 6 months ago
Selected Answer: B
only: B. ClassA.__module__ == '__main__'
upvoted 1 times
...
Noarmy315
2 years, 11 months ago
A. False B. True C. False D. TypeError Should be B
upvoted 4 times
...
luckymuki
3 years, 1 month 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 ...