PCAP Exam QuestionsBrowse all questions from this exam

PCAP Exam - Question 82


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

A.

B.

C.

D.

Show Answer
Correct Answer:

AC

Discussion

7 comments
Sign in to comment
DTL001
Dec 18, 2021

Correct Answer: AC.

Jnanada
Aug 18, 2022

Correct Answer AC B - ValueError will be thrown.

luckymuki
Oct 23, 2021

What is wrong with answer B? Looks like correct option as well

Misco33
Nov 6, 2021

You're right, that snippet prints 0 and doesn't raise any exception.

VigneshVj
Nov 22, 2021

In B,else block will be executed and it will throw "ValueError: invalid literal for int() with base 10: ''"

dhikra
Nov 28, 2021

i think answer BC !!

Dav023
Sep 26, 2022

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'

macxsz
May 3, 2022

Answer: BC

macxsz
May 3, 2022

sorry, answer is A and C

seaverick
Jan 27, 2024

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