Mastering Python Loops, Lists and Strings

Quiz
•
Computers
•
11th Grade
•
Hard
Harmeet Kaur
FREE Resource
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the syntax for a for loop in Python?
foreach variable in sequence:
for each variable in sequence:
for (variable; condition; increment)
for variable in sequence:
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
How do you create a while loop that runs until a variable reaches 10?
while (variable = 10) { variable++; }
while (variable < 10) { variable++; }
while (variable != 10) { variable++; }
while (variable > 10) { variable--; }
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What method would you use to convert a string to lowercase in Python?
lowercase()
convertToLower()
.lower()
.toLowerCase()
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
How can you create a list of squares of numbers from 1 to 10 using list comprehension?
[x^2 for x in range(1, 10)]
[x**2 for x in range(1, 11)]
[x*2 for x in range(1, 11)]
[x**3 for x in range(1, 11)]
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of the following code: for i in range(5): print(i)?
0 1 2 3 4
3.5
-1
5
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Explain how nested loops work with an example.
For example, in a 2D array, an outer loop can iterate through rows, while an inner loop iterates through columns: for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { process(array[i][j]); } }
An outer loop cannot access the inner loop's variables.
Nested loops can only be used with single-dimensional arrays.
Nested loops are not efficient for processing data.
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What string method would you use to find the length of a string?
length()
count()
len()
size()
Create a free account and access millions of resources
Similar Resources on Wayground
34 questions
T-Level DPDD: Data Types Quiz

Quiz
•
11th Grade
26 questions
Python functions (Built-in and User defind functions)

Quiz
•
11th Grade
35 questions
PLTW CSE Unit 1.3 Review

Quiz
•
9th - 12th Grade
27 questions
Python Loops

Quiz
•
9th - 12th Grade
30 questions
Python Beginner

Quiz
•
6th - 12th Grade
32 questions
Pemrograman Python Test Medium

Quiz
•
11th Grade
25 questions
Python Conditional Statements

Quiz
•
9th - 12th Grade
29 questions
JavaScript

Quiz
•
9th - 12th Grade
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
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade