Introduction to Python - Loops and Logic

Quiz
•
Computers
•
1st - 6th Grade
•
Easy
Khadeeja Haji
Used 15+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many numbers does this code output?
x = 0
while x < 8:
print(x)
x +=1
The numbers from 0 to 7
The numbers from 0 to 8
The numbers from 1 to 8
The numbers from 1 to 7
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many stars does this code output?
for i in range(5):
print("*")
1
2
4
5
3.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
What is missing in this code for it to work properly?
x=0
while x < 5:
print(x)
x + 1
x += 1
x
+1
4.
MULTIPLE CHOICE QUESTION
30 sec • 2 pts
Which line makes this an infinite loop?
x = 6
while True:
print(x)
if x == 4:
break
x+=1
x+=1
break
while True
x == 4
Answer explanation
A while loop runs as long as the condition it has is true, in this case True can never be false, so the line that makes it INFINITE (it runs forever) is:
while True
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What type of loop is a for loop?
a conditional loop
a counter controlled loop
a variable
a number
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What type of loop is a while loop?
a counter controlled loop
a variable
a letter
a conditional loop
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many numbers will this loop print?
for i in range(1,7):
print(i)
Numbers 1 to 6
Numbers 0 to 7
Numbers 1 to 7
Numbers 1 to 8
Create a free account and access millions of resources
Similar Resources on Wayground
14 questions
Hour of Code ESL

Quiz
•
6th - 8th Grade
14 questions
MS Word 4

Quiz
•
3rd Grade
15 questions
Python - podstawy

Quiz
•
4th - 5th Grade
14 questions
PREUPS 3 SEM2 DC024 D2T3

Quiz
•
1st Grade
15 questions
Scratch

Quiz
•
6th - 8th Grade
7 questions
Boolean logic

Quiz
•
6th - 8th Grade
10 questions
COMPUTERS

Quiz
•
2nd Grade
10 questions
Scratch Programming Language

Quiz
•
3rd Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
8 questions
Time Management

Quiz
•
6th Grade
15 questions
Acceptable Use Policy (Quiz)

Quiz
•
6th - 8th Grade
25 questions
Career Vs. Job

Quiz
•
6th - 8th Grade
12 questions
3-5 Digital Citizenship: Appropriate Use

Quiz
•
3rd - 5th Grade
10 questions
Keyboard Typing

Quiz
•
4th Grade
20 questions
Copyright and Fair Use

Quiz
•
6th - 8th Grade
16 questions
Input and Output devices

Quiz
•
5th Grade