loops and iterables in python

loops and iterables in python

University

20 Qs

quiz-placeholder

Similar activities

Java Quiz 4

Java Quiz 4

University

15 Qs

Hexadecimal - decimal y binario

Hexadecimal - decimal y binario

University

17 Qs

Skill Competition Quiz 2024

Skill Competition Quiz 2024

10th Grade - University

20 Qs

Introducción Redes Tele1 IB

Introducción Redes Tele1 IB

10th Grade - University

15 Qs

SOFTWARE 7I

SOFTWARE 7I

7th Grade - University

20 Qs

Coding Karel 2

Coding Karel 2

KG - University

20 Qs

ITE TEST 2

ITE TEST 2

University

20 Qs

Computer Hardware - CPU & GPU

Computer Hardware - CPU & GPU

7th Grade - University

16 Qs

loops and iterables in python

loops and iterables in python

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Prince Kumar

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

for i in range(3):

print(i)

1 2 3

0 1 2

0 1 2 3

1 2 3 4

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What function creates an iterator for a given object?

iter()

next()

iterator()

loop()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the break statement?

To stop the iteration and exit the loop

To skip the current iteration

To pause the iteration

To restart the loop

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code?

for i in range(2, 5):

print(i, end=" ")

1 2 3 4

2 3 4

2 3 4 5

1 2 3 4 5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a mutable data type in Python?

String

Tuple

List

Set

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code print?

list1 = [1, 2, 3, 4, 5]

print(list1[1:4])

[1, 2, 3]

[2, 3, 4]

[2, 3, 4, 5]

[1, 2, 3, 4]

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you iterate over a dictionary?

for key, value in dict.items():

for key, value in dict.values():

for value in dict.keys():

for item in dict:

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers