Python Loops and Range Quiz

Python Loops and Range Quiz

12th Grade

9 Qs

quiz-placeholder

Similar activities

Python_R

Python_R

2nd Grade - Professional Development

8 Qs

Prog. no Des. de Sistemas - Implementando o encerramento do jogo

Prog. no Des. de Sistemas - Implementando o encerramento do jogo

12th Grade

10 Qs

Python Variables Quiz

Python Variables Quiz

12th Grade

12 Qs

Python List Basics

Python List Basics

12th Grade

14 Qs

L.7.LOOPING STRUCTURE

L.7.LOOPING STRUCTURE

12th Grade

10 Qs

Python 2

Python 2

9th - 12th Grade

10 Qs

Code Tracing Quiz

Code Tracing Quiz

9th - 12th Grade

12 Qs

Coding and Robotics

Coding and Robotics

8th - 12th Grade

12 Qs

Python Loops and Range Quiz

Python Loops and Range Quiz

Assessment

Quiz

Computers

12th Grade

Medium

Created by

Nicholas Marsh

Used 1+ times

FREE Resource

9 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:

for i in integer:

for loop in string:

for item in iterable

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How is the range function used in Python?

The range function in Python is used to generate a sequence of numbers.

The range function in Python is used to calculate the average of a sequence of numbers.

The range function in Python is used to sort a sequence of numbers in ascending order.

The range function in Python is used to find the maximum value in a sequence of numbers.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of looping through lists in Python?

To skip over each element in the list without performing any action or operation.

To reverse the order of the elements in the list.

To check if a specific element is present in the list without iterating through all elements.

To iterate over each element in the list and perform a specific action or operation on each element.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? numbers = [1, 2, 3, 4, 5] for num in numbers: print(num * 2)

2, 4, 6, 8, 10

1, 3, 5, 7, 9

2, 4, 6, 8

1, 2, 3, 4, 5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

1 2 3 4 5

0 1 2 3 5

0 1 2 3 6

0 1 2 3 4

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 7

1 3 5

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? fruits = ['apple', 'banana', 'cherry'] for fruit in fruits: print(fruit)

apple banana cherry

apple banana cherry

apple cherry banana

banana apple cherry

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which loop control statement is used to terminate the loop completely?

continue

break

return

exit

9.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which loop control statement is used to move on to the next iteration of the loop?

continue

break

return

exit