Python If-Else Decision Making Quiz
Decision-making is a very important part in the day to day life. To make things easy we have some built-in code blocks that allow the user to write a conditional code flow. Without wasting any more time, let us now move ahead and check our concepts.
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
What is the result of the condition passed in the if block in Python?
CorrectIncorrect - Question 2 of 15
2. Question
How many conditions can be specified in an if block?
CorrectIncorrect - Question 3 of 15
3. Question
What is the correct syntax for the if-else block?
CorrectIncorrect - Question 4 of 15
4. Question
What can be put in the if code block if you don’t want any execution in the block?
CorrectIncorrect - Question 5 of 15
5. Question
What is the shorthand for the else block combined with an if block in python?
CorrectIncorrect - Question 6 of 15
6. Question
What will be the output of the code given below?
# Code Snippet Starts
if(‘true’):
print(“Hello, from QuizOrbit!”)
else:
print(“Exit!”)
# Code Snippet Starts
CorrectIncorrect - Question 7 of 15
7. Question
Find the output of the code given below?
# Code Snippet Starts
a=12
b=16
if (a-b):
print(‘Quizorbit domain’)
else:
pass
# Code Snippet Starts
CorrectIncorrect - Question 8 of 15
8. Question
What will be the output of the code given below?
# Code Snippet Starts
if (0 or 5):
print(‘If is executed’)
else:
pass
# Code Snippet Starts
CorrectIncorrect - Question 9 of 15
9. Question
Find the output of the code given below?
# Code Snippet Starts
a = 12
b = 15
c = 18
if (a>b):
b+=5
elif(b>c):
c+=5
elif(c>a):
a+=9
print(a,b,c)
# Code Snippet Starts
CorrectIncorrect - Question 10 of 15
10. Question
Find the output of the code given below?
# Code Snippet Starts
a = 12
b = 15
c = 18
if a%2==0:
if b%c == 1:
c-=5
b+=12
if c%a == 6:
b-=13
else:
a=b=c=0
print(a,c)
# Code Snippet Starts
CorrectIncorrect - Question 11 of 15
11. Question
Find the output of the code given below?
# Code Snippet Starts
l = [i for i in range(42,150,16)]
lOne = []
lTwo = []
for j in l:
if(j%5==0):
lOne.append(j)
else:
lTwo.append(j)
print(abs(len(lOne)-len(lTwo)))
# Code Snippet Starts
CorrectIncorrect - Question 12 of 15
12. Question
Find the output of the code given below?
# Code Snippet Starts
arr = [123,78,34,6,89,100,56,78]
del arr[3]
arr.append([23,45])
if(6 in arr):
print(arr[5])
elif(45 in arr):
print(arr[-1])
else:
del arr[-4]
arr.remove(78)
print(arr)
# Code Snippet Starts
CorrectIncorrect - Question 13 of 15
13. Question
Find the output of the code given below?
# Code Snippet Starts
s = ‘QuizOrbit’
if(s.isupper()):
print(s.lower)
elif(s.islower()):
print(s.upper)
else:
pass
# Code Snippet Starts
CorrectIncorrect - Question 14 of 15
14. Question
Find the output of the code given below? # Code Snippet Starts
val = (23,14,25)
val[1]=90
if(90 in val):
print(“You win”)
else:
print(“Exit!”)
# Code Snippet Starts
CorrectIncorrect - Question 15 of 15
15. Question
What will be the output of the code given below?
# Code Snippet Starts
arr = [23,67,54,68,90,78]
del arr[3]
arr.append([23,45])
if(len(arr)):
print(len(arr))
# Code Snippet Starts
CorrectIncorrect
Summary
We hope you might have got a great test of your decision-making skills with this quiz. Conditionals are the backbone of any programming language and make sure to strengthen them.
Drop any suggestions and queries in the comments. Happy Learning!
This option is wrong in 8th question