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 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 (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
DTL001
Highly Voted 2 years, 11 months ago
Correct Answer: AC.
upvoted 6 times
...
Jnanada
Highly Voted 2 years, 3 months ago
Correct Answer AC B - ValueError will be thrown.
upvoted 5 times
...
seaverick
Most Recent 10 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
2 years, 2 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
2 years, 6 months ago
Answer: BC
upvoted 1 times
macxsz
2 years, 6 months ago
sorry, answer is A and C
upvoted 5 times
...
...
dhikra
3 years ago
i think answer BC !!
upvoted 2 times
...
luckymuki
3 years, 1 month ago
What is wrong with answer B? Looks like correct option as well
upvoted 2 times
Misco33
3 years ago
You're right, that snippet prints 0 and doesn't raise any exception.
upvoted 1 times
...
VigneshVj
3 years 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 ...