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

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

What is the expected behavior of the following code?

  • A. it outputs 3
  • B. the code is erroneous and it will not execute
  • C. it outputs 1
  • D. it outputs 2
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
seaverick
10 months ago
Selected Answer: C
s='2A' try: n=int(s) except TypeError: n=3 except LookupError: n=2 except: n=1 print(n) Ans is C
upvoted 1 times
...
macxsz
2 years, 6 months ago
Selected Answer: C
C. it outputs 1
upvoted 1 times
...
lukaki
3 years ago
This is ValueError, thus 'except' will be executed. It means answer is C
upvoted 4 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 ...