Python Quiz 3

PYTHON QUIZ 3

CONGRATULATIONS! YOU HAVE COMPLETED PYTHON QUIZ 3. YOU HAVE %%SCORE%% TRUE ANSWERS OUT OF %%TOTAL%% QUESTIONS. YOUR SCORE IS %%PERCENTAGE%%. %%RATING%%
Your answers are highlighted below.
Question 1
What is the output of this python code?
numbers1 = {17,22,80}
numbers2 = {12,17,56,80,92}
print(numbers1.symmetric_difference(numbers2))
A
{17,22,80}
B
{12,17,56,80,92}
C
{12,17,17,22,56,80,80,92}
D
{22, 56, 12, 92}
E
{12,17,22,56,80,92}
Question 2
What is the output of this code?
try:
a=5
print(a)
except:
print("An Error!")
else:
print("All is Good!")
A
An Error!
B
5
C
All is Good!
D
5 All is Good!
E
Exception
Question 3
What is the output of this python code?
numbers1 = {1,2,3}
numbers2 = {2,3,7,10,15}
print(numbers2.difference(numbers1))
A
{1,2,3,7,10,15}
B
{2,3,7,10,15}
C
{1,2,3}
D
{10, 15, 7}
E
none of them
Question 4
What is the maximum value for an integer in Python 3?
A
16512
B
65536
C
no limit
D
0
E
32767
Question 5
How to create a function named FirstFunction?
A
create FirstFunction():
B
create FirstFunction()
C
set FirstFunction():
D
def FirstFunction():
E
def FirstFunction()
Question 6
Which symbol is used for comments in python?
A
-
B
/
C
//
D
#
E
*
Question 7
How to access the last item in the list x?
A
x[ ]
B
x[-1]
C
x[-%]
D
x[-]
E
x[1]
Question 8
... block lets you test a block of code for errors.
A
finally
B
none of them
C
try
D
except
E
raise
Question 9
How to access "wolf", "lion" and "tiger" items in list x? 
x= ["eagle","bear","wolf", "lion", "tiger"]
A
x[2:3]
B
x[:2]
C
x[2:]
D
x[3:]
E
x[-1:2]
Question 10
What is the result of this python code?
list = [4,6,7,2,8]
list.insert(3,10)
print(list)
A
[4, 6, 7, 2, 8]
B
[4, 6, 7, 2, 8, 3]
C
[4, 6, 7, 10, 2, 8]
D
[4, 6, 7, 3, 2, 8]
E
[4, 6, 7, 2, 8, 10]
Question 11
What is the Output Of This Python Math Code?
import math
print(math.sqrt((pow(5,2)-5)*5))
A
25.0
B
30.0
C
15.0
D
20.0
E
10.0
Question 12
What is the result of this code?
import math
print(round(12.5)-round(10.7))
A
2
B
3
C
1
D
4
E
0
Question 13
What is the output of this python code?
i = 0
list1 = []
while i < 30:
if i%5==0:
list1.append(i)
i += 1
print(list1)
A
[5, 10, 15, 20, 25, 30]
B
[5, 10, 15, 20, 25]
C
[5, 10, 15, 20]
D
[0, 5, 10, 15, 20, 25]
E
[0, 5, 10, 15, 20, 25, 30]
Question 14
What is the output of this code?
msg = "Welcome to python course!"
x = msg.index("python")
print(x)
A
11
B
12
C
8
D
9
E
10
Question 15
What is the output of the below python code?
list=[]
for x in range(1,10,1):
list.append(pow(x,2))
print(list)
A
[1, 2, 3, 4, 5, 6, 7, 8, 9]
B
[1, 10]
C
[1, 100]
D
[1, 4, 9, 16, 25, 36, 49, 64, 81]
E
[1, 3, 5, 7, 9]
Question 16
What is the Output of This Python Code?
a = 5
b = 2
c = 3
print((b**a-a*c)%b)
A
3
B
2
C
0
D
4
E
1
Question 17
With which python method, we replace some part of a string?
A
sort()
B
change()
C
strip()
D
convert()
E
replace()
Question 18
What is the result of this python code?
def findfactorial(a):
if a == 1:
return 1
else:
return (a * findfactorial(a-1))
print(findfactorial(5))
A
40
B
180
C
100
D
60
E
120
Question 19
What is the output of this code? (Be careful :)
l1 = [1, [2, 3], 4]
l2 = l1.copy()
l2[1][1]=7
print(l1, l2)
A
[1, [2, 7], 4] [1, [2, 3], 4]
B
[1, [2, 3], 4] [1, [2, 7], 4]
C
[1, [2, 3], 4] [1, [2, 3], 4]
D
none of them
E
[1, [2, 7], 4] [1, [2, 7], 4]
Question 20
If statement, without indentation rises error.
A
True
B
False
Once you are finished, click the button below. Any items you have not completed will be marked incorrect. Get Results
There are 20 questions to complete.
gokhan-kosem-instructor-ipcisco

Gokhan Kosem is a Network Engineer, Instructor and the Founder of IPCisco.com with 15+ years of experience in Cisco, Nokia, Huawei, Juniper, Linux, Service Provider Networks, Routing and Switching technologies.

He has worked on the backbone networks of major service providers and network vendors including Nortel, Alcatel-Lucent (Nokia) and has extensive hands-on experience with Cisco, Huawei, Juniper and Nokia networking technologies.

He has trained thousands of networking students worldwide through IPCisco.com, Udemy, books, labs, quizzes, and educational content across multiple social media platforms.

IPCisco.com | Best Route to Your Dreams