For Loop in Python

For Loop in Python

11th Grade

10 Qs

quiz-placeholder

Similar activities

Pseudocode - OCR ERL

Pseudocode - OCR ERL

9th - 12th Grade

10 Qs

29W Quiz 2 - PLTW

29W Quiz 2 - PLTW

9th - 12th Grade

12 Qs

Global and local variables

Global and local variables

10th - 12th Grade

10 Qs

10 CS // Pseudocode

10 CS // Pseudocode

9th - 11th Grade

10 Qs

Nested If

Nested If

6th - 12th Grade

15 Qs

KS4 - Python Turtle

KS4 - Python Turtle

9th - 11th Grade

15 Qs

PYTHON PROGRAMMING

PYTHON PROGRAMMING

11th - 12th Grade

15 Qs

Python Loops

Python Loops

9th - 11th Grade

12 Qs

For Loop in Python

For Loop in Python

Assessment

Quiz

Computers

11th Grade

Hard

Created by

Nirender Prakash Singh

Used 21+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax of a for loop in Python?

for item in iterable: # code to be executed

for i in range(n): # code to be executed

for element in list: # code to be executed

for item in iterable: # code to be executed

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define the range of a for loop in Python?

By using the range() function with start, stop, and step parameters.

By using the len() function with the iterable as the parameter.

By using the start, stop, and step parameters directly in the for loop.

By using the range() function with only the stop parameter.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the else statement in a for loop?

To specify a block of code to be executed before the loop starts

To specify a block of code to be executed if the loop completes normally

To specify a block of code to be executed if the loop does not complete normally

To specify a block of code to be executed after each iteration of the loop

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many times does a for loop iterate if the range is (1, 5)?

4

2

1

3

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the output of the following code?

0 1 2 Loop completed

0 1 2

3

0

1

2

0 1 2

3

Loop completed

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? for i in range(1, 6, 2): print(i)

1 2 3 4 5

1 2 3 4

1 3 5

1 3 5 7

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? for i in range(5, 0, -1): print(i)

1

2

3

4

5

1

2

3

4

5

4

3

2

1

4

3

2

1

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?