Quiz on Loops in Python
Loops are an integral part of any programming language that we use. Similarly, in python, we have loops available to us for creating iterations. Let us check your concepts of the Python loops in the upcoming quiz.
All the best!
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
- Question 1 of 15
1. Question
Why do we need loops in programming?
CorrectIncorrect - Question 2 of 15
2. Question
How do we differentiate the body of the loop from the rest of the code?
CorrectIncorrect - Question 3 of 15
3. Question
Which of the following is a loop in python?
CorrectIncorrect - Question 4 of 15
4. Question
Which of the following creates iterable elements?
CorrectIncorrect - Question 5 of 15
5. Question
Find the count of even numbers in the output of the code given below?
# Code snippet starts
for i in range(23,102,25):
print(i, end = “-“)
print(“0″,end=” “)
# Code snippet ends
CorrectIncorrect - Question 6 of 15
6. Question
What will be the output of the code given below?
# Code snippet starts
val = list(range(132,78,-12))
print(val)
# Code snippet ends
CorrectIncorrect - Question 7 of 15
7. Question
Find the output of the code given below?
# Code snippet starts
val = 500
while val>=230:
val = val*2//7
print(val)
# Code snippet ends
CorrectIncorrect - Question 8 of 15
8. Question
Find the output of the code given below?
# Code snippet starts
org = “QuizOrbit”
l = len(org)
i = 0
while i <= l-1 :
if org[i].isupper():
print(org[i],end=” “)
i+=1
else:
i+=1
break
# Code snippet ends
CorrectIncorrect - Question 9 of 15
9. Question
Find the number of characters in the result string from the code given below?
# Code snippet starts
org = “QuizOrbit”
l = len(org)
i = 0
while i <= l-1 :
if org[i].isupper():
print(org[i],end=””)
i+=1
else:
i+=1
# Code snippet ends
CorrectIncorrect - Question 10 of 15
10. Question
Find the output of the code given below?
# Code snippet starts
num = 5
for _ in range(0,num):
for i in range(‘a’,’d’):
print(i)
# Code snippet ends
CorrectIncorrect - Question 11 of 15
11. Question
Find the number of digits of the result produced by code given below?
# Code snippet starts
i = 97
res = ”
while i <= 121 :
res+=str(i)
i+=17
print(res)
# Code snippet ends
CorrectIncorrect - Question 12 of 15
12. Question
Find the output of the code given below?
# Code snippet starts
l = [‘a’,’e’,’i’,’o’,’u’]
org = ‘QuizOrbit’
count = 0
for i in org:
if i in l:
count+=1
else:
continue
print(count)
# Code snippet ends
CorrectIncorrect - Question 13 of 15
13. Question
Find the output of the code given below?
# Code snippet starts
l = [‘z’,’o’,’u’]
org = ‘QuizOrbit’
count = 0
for i in org:
if i in l:
count+=1
else:
continue
print(count%2)
# Code snippet ends
CorrectIncorrect - Question 14 of 15
14. Question
How many numbers appear in the output of the code given below?
# Code snippet starts
l = [102,587,523,45,12,612,78,214]
for i in range(100,784,256):
if i in l:
print(i,end=” “)
else:
continue
# Code snippet ends
CorrectIncorrect - Question 15 of 15
15. Question
Which of the following is used when we want to exit a loop?
CorrectIncorrect
Summary
We hope that you might have got an understanding of the concepts involved with the loops in python. We have covered all the types of loops in python and recommend moving ahead when you clear all the concepts involved here. Happy Learning!
THe correct answer should be 0.
.
.
..
Question 3: a loop starts with the word while, all in lower case not While, as you wrote.
wrong answer
loop will run 2 times only
no correct answer
I should be zero