
Loops, Functions, and Conditions Basics
Authored by Abdullah Muhammad 201-801-271
Computers
University
Used 2+ 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
Which loop is guaranteed to execute at least once in Python?
for
while
do-while
repeat-until
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct syntax for a for loop in Python?
for variable in iterable:
for variable of iterable:
foreach variable in iterable:
for variable -> iterable:
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you terminate a loop prematurely in Python?
continue
break
return
stop
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the continue statement do in a loop?
Exits the loop completely
Skips the rest of the code inside the loop for the current iteration and proceeds to the next iteration
Restarts the loop
Pauses the loop execution
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? for i in range(3): print(i,end='')
012
123
0123
01234
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the default return value of a function if no return statement is used?
None
0
'' (empty string)
False
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you define a function in Python?
function name(parameters):
def name(parameters):
define name(parameters):
func name(parameters):
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?