PCAP Exam QuestionsBrowse all questions from this exam

PCAP Exam - Question 114


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

A.

B.

C.

D.

Show Answer
Correct Answer:

D

Discussion

8 comments
Sign in to comment
Nenggg
Dec 11, 2022

A and D are correct.

MTLE
Apr 25, 2022

AD should be right

Baldridge
May 31, 2022

A D are correct

stuartz
Jun 20, 2022

A and D are correct. B fails, C has no exception to handle

Dav023
Sep 29, 2022

A and D are correct.

emanuelcar990
Aug 17, 2023

try: print(float("1e1")) except (ValueError, NameError): print(float("1a1")) else: print(float("101")) try: print(0/1) except: print(1/1) else: print(2/1) are the correct , because float("1e1") = 10,0 then the else : float("101") = 101.0 the other code = 0 /1 = 1 then else: 2/1 = 2 so A D

macxsz
Apr 30, 2022

Only D is right. A raises another exception after the first ValueError exception

fermins
Feb 2, 2024

try: print(float('1e1')) except (ValueError, NameError): print(float('1a1')) else: print(float('101')) Rises no exception. Both A and D are correct