exam questions

Exam PCAP-31-03 All Questions

View all questions & answers for the PCAP-31-03 exam

Exam PCAP-31-03 topic 1 question 57 discussion

Actual exam question from Python Institute's PCAP-31-03
Question #: 57
Topic #: 1
[All PCAP-31-03 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. __name__ == 'code.py'
  • C. str(Object) == 'Object'
  • D. ClassA.__module__ == '__main__'
Show Suggested Answer Hide Answer
Suggested Answer: CD 🗳️

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
Dave304409
9 months ago
Selected Answer: CD
is correct, test in my IDE
upvoted 2 times
...
JeyTlenJey
9 months ago
Selected Answer: CD
Correct: C, D print("A.", ClassB.__bases__, len(ClassB.__bases__),len(ClassB.__bases__) == 2) #False, it returns 1 as one module is there print("B.", __name__, __name__ == 'code.py') #False, it is: __main__ print("C.", str(Object), str(Object) == 'Object') #True print("D.", ClassA.__module__, ClassA.__module__ == '__main__') #True
upvoted 1 times
...
DKAT2023
9 months, 2 weeks ago
Selected Answer: D
only D are correct, C not correct should be : _str_(Object) == 'Object'
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago