
Mastering Python Basics
Authored by Sakthivel Duraisamy
Computers
12th Grade
Used 5+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for a for loop in Python?
for variable in sequence[]
for (variable : sequence)
for variable in (sequence)
for variable in sequence:
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you iterate over a list using a for loop?
foreach item in my_list:
for each item in my_list:
for item in list my_list:
for item in my_list:
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code: for i in range(5): print(i)?
0 1 2 3 4
-1
10
5
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you create an infinite while loop in Python?
while True:
while False:
while 1:
while x < 10:
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between a while loop and a for loop?
A while loop is always faster than a for loop.
A for loop can only iterate over arrays, while a while loop can iterate over any data type.
A while loop requires a counter variable, while a for loop does not.
A while loop checks the condition before each iteration, while a for loop is used for a specific number of iterations with initialization and increment.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you break out of a while loop?
Use the 'continue' statement.
Remove the loop condition.
Use the 'break' statement.
Add a return statement.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the continue statement in a loop?
The continue statement restarts the loop from the beginning.
The continue statement ends the loop immediately.
The continue statement pauses the loop for a specified time.
The continue statement skips the current iteration of a loop.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
GPS
Quiz
•
9th Grade - University
18 questions
Quiz Reti
Quiz
•
9th - 12th Grade
20 questions
Penilaian Akhir Semester (PAS) Pemrograman Web dan PPL
Quiz
•
12th Grade
20 questions
REMEDI PAS - DESAIN DAN KOMP. GRAFIS
Quiz
•
12th Grade
15 questions
After Effect Intoduction
Quiz
•
10th Grade - University
21 questions
Visual Basic Assessment
Quiz
•
11th - 12th Grade
15 questions
Dasar Desain Grafis
Quiz
•
12th Grade - University
15 questions
PRUEBA CORTA I - SISTEMA E INSTALACIÓN DE SOFTWARE I - U4
Quiz
•
9th - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade