loops and iterables in python

Quiz
•
Computers
•
University
•
Medium
Prince Kumar
Used 1+ times
FREE Resource
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:
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Python Files

Quiz
•
University
15 questions
Игруха

Quiz
•
University
20 questions
Beginner Quiz on ML and Python Basics

Quiz
•
University
20 questions
Python Lists and Sets

Quiz
•
9th Grade - University
15 questions
Conditionals Unit Quiz

Quiz
•
9th Grade - University
20 questions
Python Programming II CSE A

Quiz
•
12th Grade - University
15 questions
Python Quiz Ver- 1.3

Quiz
•
University
15 questions
Quiz Algoritma Looping

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University