What's your mood today?
python loop practice

Quiz
•

Felipe Millacura
•
Computers
•
Professional Development
•
25 plays
•
Hard
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • Ungraded
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the result of executing the following code?
number = 5
while number <= 5:
if number < 5:
number = number + 1
print(number)
The program will loop indefinitely
The value of number will be printed exactly 1 time
The while loop will never get executed
The value of number will be printed exactly 5 times
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will the following code print?
counter = 1
sum = 0
while counter <= 6:
sum = sum + counter
counter = counter + 2
print(sum)
12
9
7
8
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will be printed by the following code when it executes?
sum = 0
values = [1,3,5,7]
for number in values:
sum = sum + number
print(sum)
4
0
7
16
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the last thing printed when the following code is run?
number = 0
while number <= 10:
print("Number: ", number)
number = number + 1
Number: 10
Number: number
Number: 0
Number: 11
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What does the following code print?
output = ""
x = -5
while x < 0:
x = x + 1
output = output + str(x) + " "
print(output)
5 4 3 2 1
-4 -3 -2 -1 0
-5 -4 -3 -2 -1
This is an infinite loop, so nothing will be printed
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What are the values of var1 and var2 that are printed when the following code executes?
var1 = -2, var2 = 0
var1 = 0, var2 = -2
var1 = 0, var2 = -1
This is an infinite loop, so nothing will be printed
Create a free account and access millions of resources
Similar Resources on Quizizz
10 questions
C Programming

Quiz
•
Professional Development
16 questions
Final Assessment

Quiz
•
Professional Development
17 questions
Java programming

Quiz
•
Professional Development
12 questions
M1_Week2_TimeMachine

Quiz
•
Professional Development
10 questions
Day 3

Quiz
•
Professional Development
10 questions
Python Lesson 1

Quiz
•
Professional Development
10 questions
Python Session 5

Quiz
•
Professional Development
12 questions
DECI - Week 9 - round

Quiz
•
Professional Development
Popular Resources on Quizizz
39 questions
Respect and How to Show It

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
10 questions
Human Body Systems and Functions

Interactive video
•
6th - 8th Grade
20 questions
Multiplication Facts

Quiz
•
3rd Grade
Discover more resources for Computers
15 questions
Disney Characters Quiz

Quiz
•
Professional Development
19 questions
Minecraft

Quiz
•
6th Grade - Professio...
14 questions
Disney Trivia

Quiz
•
Professional Development
20 questions
90s Cartoons

Quiz
•
Professional Development
11 questions
All about me

Quiz
•
Professional Development
20 questions
Disney characters

Quiz
•
KG - Professional Dev...
20 questions
Block Buster Movies

Quiz
•
10th Grade - Professi...
20 questions
Count / Non-count Nouns Quiz

Quiz
•
Professional Development