Python Datatypes, Operators and Conditional Statements Quiz
Question 1
What is the purpose of the else clause in a Python if-else statement?
It is used to handle exceptions.
It is executed when the if condition is true.
It is executed when none of the preceding if or elif conditions are true.
It is used to terminate the program.
Question 2
Find the output of the below python program:
tup= (1, 2, 3, 4)
tup.append( (5, 6, 7) )
print(len(tup))
5
6
3
Compilation Error
Question 3
Find the output of the below python program:
tuple1 = (1, 2, 4, 3) tuple2 = (1, 2, 3, 4) print(tuple1 < tuple2)
Error
True
False
false
Question 4
Find the output of the below python code:
set1 = {1, 2, 3} set2 = {4, 5, 6} print(len(set1 + set2))
3
6
Error
Unexpected
Question 5
What is the type casting in the below code:
a=11 print(str(a))
Implicit type conversion
Explicit type conversion
None of the above
There are 14 questions to complete.