Python Datatypes, Operators and Conditional Statements Quiz
Question 1
What is the type of python language?
Statically typed language
Dynamically typed language
None of the above
Question 2
Find the output of the below python code:
x=4
print(x)
x="GFG"
x+="Hello"
print(x)
4
Compilation Error
4
GFGHello
4
Hello
None of the above
Question 3
Find the output of the below python code:
x=4
print(id(x))
print(id((int)(x+"GFG"))
Object Address
Object Address
Compilation Error
Object Address
Object Address
Compilation Error
None of the above
Question 4
Find the output of the below python program:
x=10
print(type(x))
x="GFG"
print(type(x))
<class 'int'>
<class 'str'>
<class 'int'>
None of the above
Compilation Error
None of the above
Question 6
Find the output of the python code:
s = "gfg"
print(("g" or "") in s)
Error
True
False
None of the above
Question 7
Find the output of the below python code:
print(oct(23))
0o27
0o00
0027
None of the above
Question 8
Find the output of the below python code:
s = "gfg"
print("G" in s)
1
0
False
True
Question 9
Which of the following statements is true regarding the if-else statement in Python?
The else block is mandatory.
The if block is optional.
Either the if block or the else block will be executed, but not both.
Both the if and else blocks can be executed under certain conditions.
Question 10
What is the purpose of the elif keyword in a Python if-elif-else statement?
It is short for "else if" and is used to check multiple conditions sequentially.
It is used to terminate the program if the if condition is false.
It is used to declare a variable.
It is executed when the if condition is true.
There are 11 questions to complete.