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

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

Which of the following snippets will execute without raising any unhandled exceptions? (Choose two.)
A.

B.

C.

D.

Show Suggested Answer Hide Answer
Suggested Answer: AC

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
DTL001
Highly Voted 2 years, 4 months ago
Correct Answer: AC.
upvoted 6 times
...
Jnanada
Highly Voted 1 year, 8 months ago
Correct Answer AC B - ValueError will be thrown.
upvoted 5 times
...
seaverick
Most Recent 3 months ago
try: print(0/0) except: print(0/1) else: print(0/2) #try: # print(int("0")) #except NameError: # print("0") #else: # print(int(""))#ValueError: invalid literal for int() with base 10: '' import math try: print(math.sqrt(-1)) except: print(math.sqrt(0)) else: print(math.sqrt(1)) #try: # print(float("1e1")) #except (NameError, SystemError): # print(float("1a1")) #else: # print(float("1c1"))#ValueError: could not convert string to float: '1c1' Ans is A,C
upvoted 1 times
...
Dav023
1 year, 7 months ago
B: ----> 6 print(int("")) ValueError: invalid literal for int() with base 10: '' C:----> 6 print(float("1c1")) ValueError: could not convert string to float: '1c1'
upvoted 2 times
...
macxsz
1 year, 11 months ago
Answer: BC
upvoted 1 times
macxsz
1 year, 11 months ago
sorry, answer is A and C
upvoted 5 times
...
...
dhikra
2 years, 5 months ago
i think answer BC !!
upvoted 2 times
...
luckymuki
2 years, 6 months ago
What is wrong with answer B? Looks like correct option as well
upvoted 2 times
Misco33
2 years, 5 months ago
You're right, that snippet prints 0 and doesn't raise any exception.
upvoted 1 times
...
VigneshVj
2 years, 5 months ago
In B,else block will be executed and it will throw "ValueError: invalid literal for int() with base 10: ''"
upvoted 5 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 ...