Python Loops Quiz (for loop and while loop)

Python Loops Quiz (for loop and while loop)

10th Grade

10 Qs

quiz-placeholder

Similar activities

Python - Loops & Lists

Python - Loops & Lists

7th - 11th Grade

15 Qs

Python Final Assessment

Python Final Assessment

4th - 12th Grade

10 Qs

Python Functions

Python Functions

9th - 12th Grade

8 Qs

While Loop Quiz

While Loop Quiz

9th - 12th Grade

12 Qs

Python

Python

1st - 10th Grade

10 Qs

KODEKIDDO HACK #MLH3

KODEKIDDO HACK #MLH3

4th Grade - University

10 Qs

Python quiz

Python quiz

10th Grade - Professional Development

10 Qs

PYTHON (FOR LOOP)

PYTHON (FOR LOOP)

1st - 10th Grade

10 Qs

Python Loops Quiz (for loop and while loop)

Python Loops Quiz (for loop and while loop)

Assessment

Quiz

Computers

10th Grade

Hard

Created by

Tempa Rinchen

Used 1+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of a while loop in Python?

To iterate over a sequence of items

To define a function

To execute a set of statements as long as a condition is true

To create a list

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if you forget to increment the variable in a while loop?

The loop will continue forever

The loop will execute twice

The loop will execute only once

The program will crash

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the break statement do in a loop?

It pauses the loop

It skips the current iteration

It stops the loop immediately

It restarts the loop

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the continue statement in a loop?

To skip the current iteration and continue with the next

To stop the loop completely

To exit the loop if a condition is met

To restart the loop from the beginning

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a type of loop in Python?

while loop

for loop

nested loop

do-while loop

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define a for loop in Python?

for each item in sequence:

for item = sequence:

for (item in sequence):

for item in sequence:

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code print? fruits = ['apple', 'banana', 'cherry']; for x in fruits: print(x)

apple banana cherry

banana cherry apple

cherry banana apple

apple, banana, cherry

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?