Quiz 3

Quiz 3

University

12 Qs

quiz-placeholder

Similar activities

Mastering Python Control Flow

Mastering Python Control Flow

University

15 Qs

Code Twisters Round 1 Demo

Code Twisters Round 1 Demo

University

10 Qs

Understanding Arrays and Loops in JavaScript

Understanding Arrays and Loops in JavaScript

11th Grade - University

7 Qs

Python_Quiz_1

Python_Quiz_1

University

10 Qs

do while , for, Arrays

do while , for, Arrays

University

16 Qs

C-Volution (Hard)

C-Volution (Hard)

University

10 Qs

placement g2 quiz-1

placement g2 quiz-1

University

15 Qs

Quiz sobre Laços de Repetição em Python

Quiz sobre Laços de Repetição em Python

University

10 Qs

Quiz 3

Quiz 3

Assessment

Quiz

Information Technology (IT)

University

Hard

Created by

Wai Li

FREE Resource

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 mins • 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
Error

2.

MULTIPLE CHOICE QUESTION

30 mins • 1 pt

What does the break statement do in a loop?
Pauses the loop
Repeats the loop
Exits the loop immediately
Skips one iteration

3.

MULTIPLE CHOICE QUESTION

30 mins • 1 pt

How many times will this loop run?

i = 0

while i < 3:

print(i)

i += 1

2
3
4
Infinite

4.

MULTIPLE CHOICE QUESTION

30 mins • 1 pt

Which of the following will create an infinite loop?
for i in range(5):
while True:
while i < 10: with i +=1
for i in range(0, -1):

5.

MULTIPLE CHOICE QUESTION

30 mins • 1 pt

Media Image
(0, 0), (1, 1)
(0, 0), (0, 1), (1, 0), (1, 1)
(2, 2)
Error

6.

MULTIPLE CHOICE QUESTION

30 mins • 1 pt

What is the correct way to loop 5 times using a while loop?
while 5:
for i in 5:
i = 0; while i < 5: i += 1
while i ==5:

7.

MULTIPLE CHOICE QUESTION

30 mins • 1 pt

Which loop will execute the body at least once, even if the condition is false initially?
for loop
while loop
Neither - Python has no do-while
Both

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?