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 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 (?) , you can switch to a simple comment.
Switch to a voting comment New
seaverick
2 months, 4 weeks 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
1 year, 11 months ago
Selected Answer: C
C. it outputs 1
upvoted 1 times
...
lukaki
2 years, 5 months 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 ...