Quiz on Python Decision Making
FREE Online Courses: Dive into Knowledge for Free. Learn More!
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
- Which values the condition in the if statement returns?
CorrectIncorrect -
Question 2 of 15
2. Question
Which of the following is the correct syntax for the if statement?
a. if condition: statement
b.
if condition:
statements
c.
if (condition):
statement
CorrectIncorrect -
Question 3 of 15
3. Question
What is the output of the following code?
a=4
if a<0:
print(“Negative”)
print(a)CorrectIncorrect -
Question 4 of 15
4. Question
- Which of the following is used to write the ladder of multiple conditionals?
CorrectIncorrect -
Question 5 of 15
5. Question
- Which of the following is not correct about the conditionals?
CorrectIncorrect -
Question 6 of 15
6. Question
What is the output of the following code?
if(‘p’ in ‘Python’):
print(‘P is present’,end=” “)
else:
print(‘Not present’)CorrectIncorrect -
Question 7 of 15
7. Question
Choose the correct output of the following code.
if(‘false’):
print(‘false’)
elif(‘true’):
print(‘true’)
else:
print(‘None’)CorrectIncorrect -
Question 8 of 15
8. Question
Which of the following code blocks give an error?
a.
opt=2
if(opt==1):
print(‘Choosen first option’)
elif(opt==2):
print(“Choosen second option”)
elif(opt==3):
print(‘Choosen third option’)
b.
if(1): print(“If block”)
else: print(“Else block”)
c.
no=5
if(no%2==0):
print(‘Even Number’)
else(no%2==1):
print(‘Odd Number’)
CorrectIncorrect -
Question 9 of 15
9. Question
What is the output of the following code?
if(” or 5 and True):
print(“Hello”,end=” “)
else:
print(‘Hi’,end=” “)
print(‘!’)
CorrectIncorrect -
Question 10 of 15
10. Question
Find the correct output for the following code?
if({3,2,3}>{2,1.2,3}):
if(True and False or False):
print(“Hi”)
elif(4 and 9):
print(‘Hello’)
else:
print(‘Welcome’)
CorrectIncorrect -
Question 11 of 15
11. Question
Which of the following gives the output as 3?
a.
a=10
b=4
if(a&b):
print((a-b)/2)
else:
print(a-b/2)
b.
a=10
b=4
if(a^b):
print((a-b)/2)
else:
print(a-b/2)
c.
a=10
b=4
if(~a):
print(a-2*b+1)
else:
print(a-b/2)
d.
a=10
b=4
if(a-b):
print(a-2*(b+1))
else:
print(a-b/2)
CorrectIncorrect -
Question 12 of 15
12. Question
What is the output of the following code?
x=5
y=3
z=2
if(y-z>5-y):
y=y+3
elif(z-x):
z=z+4
else:
x=x-1print(x+y*2-z)
CorrectIncorrect -
Question 13 of 15
13. Question
Which of the following do not give any error?
a.
a=4
b=5
if(a>b):
print(‘a>b’)
elif(a<b and a==b):
print(‘a<=b’)
b.
a=4
b=5
if(a>b):
print(‘a>b’)
elif:
print(‘a<=b’)
c.
a=4
b=5
if(a>b):
print(‘a>b’)
elif(a<b):
print(‘a<b’)
else: print(‘a==b’)
CorrectIncorrect -
Question 14 of 15
14. Question
- Which of the following is true about the decision-making statements?
CorrectIncorrect -
Question 15 of 15
15. Question
What is the output of the following code?
if([1,2,3]):
if(‘0’):
print(“1”)
else:
print(“2”)else:
print(‘3’)CorrectIncorrect