
Python Final Prep
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
Joanne Phillips-Edley
Used 4+ times
FREE Resource
Enhance your content in a minute
32 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following snippet?
def fun (x):
if x % 2 ==0:
return 1
else:
return 2
print (fun(fun(2)))
The code will cause a runtime error
2
None
1
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many stars (*) will the following snippet send to the console?
i = 0
while i < i + 2:
i += 1
print ("*")
else:
print ("*")
two
one
zero
the snippet will enter an infinite loop, printing one star per line
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the expected behavior of the following program?
try:
print (5/0)
break
except:
print ("Sorry, something went wrong...")
except (ValueError, ZeroDivisionError):
print ("Too bad...")
The program will cause a ZeroDivisionError exception and output a default error message
The program will cause a ValueError exception and output the following message: Too bad...
The program will cause a SyntaxError exception
The program will raise an exception handled by the first except block.
The program will cause a ZeroDivisionError exception and output the following message: Too bad...
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following piece of code?
print ("a", "b", "c", sep="sep")
abc
asepbsepcsep
asepbsepc
a b c
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The following snippet:
def func (a, b):
return b ** a
print (func(b=2, 2))
will output None
is erroneous
will output 2
will output 4
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code if the user enters a 0?
try:
value = input("Enter a value: ")
print (int(value)/len(value))
except ValueError:
print ("Bad input...")
except ZeroDivisionError:
print ("Very bad input...")
except TypeError:
print("Very very bad input...")
except:
print ("Booo!")
Booo1
Very bad input...
Very very bad input...
1.0
0.0
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many hashes (#) will the following snippet send to the console?
lst = [[x for x in range (3)] for y in range (3)]
for r in range (3):
for c in range (3):
if lst [r][c] % 2 !=0:
print ("#")
six
zero
three
nine
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
27 questions
ÔN TẬP CUỐI HKI_TIN 6_2425
Quiz
•
6th Grade - University
27 questions
Компьютердик эргономика боюнча тест
Quiz
•
6th Grade - University
32 questions
C++ Chapter 5 Review - Loops
Quiz
•
10th Grade - University
32 questions
KIỂM TRA 45P- MS WORD
Quiz
•
University
29 questions
NETWORK1 M2 Quiz
Quiz
•
University
30 questions
Bilgisayar Bilimi 21-22 II. Dönem 1.yazılı hazırlığı
Quiz
•
9th Grade - University
30 questions
Pengantar TIK 1-5
Quiz
•
University
27 questions
Algorithm
Quiz
•
University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
14 questions
Christmas Trivia
Quiz
•
3rd Grade - University
20 questions
Christmas Trivia
Quiz
•
University
8 questions
5th, Unit 4, Lesson 8
Lesson
•
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
•
University
