/  Python-Loops-Quiz

This Quiz contains totally 10 Questions each carry 1 point for you.

1.To create a loop which of the following keywords are used in Python?
while
loop
foreach
if

Correct!

Wrong!

2.What will be the output of the following Python code?
True = False
while True:
    print(True)
    break
True
False
None
none of the mentioned

Correct!

Wrong!

3.For which type of iteration a while loop is used in Python?
indeterminate
indefinite
discriminant
definite

Correct!

Wrong!

4.Select which is true for for loop
Python’s for loop used to iterates over the items of list, tuple, dictionary, set, or string
else clause of for loop is executed when the loop terminates naturally
else clause of for loop is executed when the loop terminates abruptly
To perform a task indefinitely we use for loop until a particular condition is met

Correct!

Wrong!

5.What will be the output of the following Python code?
x = "abcdef"
i = "a"
while i in x:
    print('i', end = " ")
no output
i i i i i i …
a a a a a a …
a b c d e f

Correct!

Wrong!

6.What is the output of the following for loop and  range()function
for num in range(-2,-5,-1):
    print(num, end=", ")
-2, -1, -3, -4
-2, -1, 0, 1, 2, 3,
-2, -1, 0
-2, -3, -4,

Correct!

Wrong!

7.What will be the output of the following Python code?
x = 'abcd'
for i in range(x):
    print(i)
a b c d
0 1 2 3
error
none of the mentioned

Correct!

Wrong!

8.for i in range(-3), how many times this loop will run ?
0
1
Infinite
Error

Correct!

Wrong!

9.For loop in python is
Exit control loop
Simple loop
Entry control loop
None of the above

Correct!

Wrong!

10.To break the infinite loop , which keyword we use ?
continue
exit
None of the above
break

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Ignore & go to results

Python-Loops-Quiz

You got %%score%% of %%total%% right

%%description%%

%%description%%

Where to go ?

Quizzes

Loading...