Introduction to Python - Loops and Logic

Introduction to Python - Loops and Logic

1st - 6th Grade

10 Qs

quiz-placeholder

Similar activities

Banana Tales Part I (1-40)

Banana Tales Part I (1-40)

6th - 8th Grade

10 Qs

8.3 Micropython unit tests

8.3 Micropython unit tests

5th Grade

10 Qs

Python Quiz - 6

Python Quiz - 6

6th - 8th Grade

10 Qs

microbit

microbit

4th Grade

10 Qs

Python Quiz 1

Python Quiz 1

6th Grade - University

12 Qs

Python - Year 8

Python - Year 8

3rd Grade - University

10 Qs

PYTHON (FOR LOOP)

PYTHON (FOR LOOP)

1st - 10th Grade

10 Qs

Python_Exam

Python_Exam

6th - 10th Grade

15 Qs

Introduction to Python - Loops and Logic

Introduction to Python - Loops and Logic

Assessment

Quiz

Computers

1st - 6th Grade

Easy

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?