Which of the following snippets will execute without raising any unhandled exceptions? (Choose two.)
A.
B.
C.
D.
Which of the following snippets will execute without raising any unhandled exceptions? (Choose two.)
A.
B.
C.
D.
D
A and D are correct.
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
A and D are correct.
A and D are correct. B fails, C has no exception to handle
A D are correct
AD should be right
Only D is right. A raises another exception after the first ValueError exception
try: print(float('1e1')) except (ValueError, NameError): print(float('1a1')) else: print(float('101')) Rises no exception. Both A and D are correct