WorksheetsData Types – GATE MCQS (Part 1)
Total questions: 25
Worksheet time: 50mins
What is the output? print(type(5/2))
float
int
double
complex
Which of the following is a valid Python identifier?
var-2
var@2
2var
var_2
What is the output? print("GATE" * 2)
Error
GATEGATE
GATE GATE
GATE2
Which statement is TRUE about Python?
Python variables must be declared
Python is statically typed
Python supports multiple inheritance
Python does not support recursion
Which of the following data types is immutable?
tuple
list
set
dictionary
What is the output? a = (1, 2, 3) a[0] = 10 print(a)
(1, 2, 3)
None
(10, 2, 3)
Error
Output of the code print(bool([0]))
Error
False
True
None
What is the output? print(type({}))
list
dict
set
tuple
What is the output of the code? print(int(5.9))
Error
5.9
6
5
Select the valid string multiplication result.
"py" * 3 gives error
"py" * 3 gives pypypy
"py" * 3 gives py py py
"py" * 3 gives pypy
Which of the following cannot be a Python identifier?
VALUE
_value
value2
for
Which of the following creates a set?
()
[]
{}
set()
Output of the code print(5 // 2)
Error
3
2
2.5
What is the output? print(2 ** 3 ** 2)
Error
16
512
64
Which operator checks object identity?
==
=
!=
is
Output of the code a = 5 b = 5 print(a is b)
None
Error
False
True
What is the output? print(True + True)
1
2
Error
True
Which operator has the highest precedence?
+
*
**
%
What is the output of the code? x = [1, 2, 3] y = x y[0] = 10 print(x)
[1, 10, 3]
Error
[10, 2, 3]
[1, 2, 3]
Which of the following is a mutable data type in Python?
frozenset
str
list
tuple
What is the output? print(3 == 3.0)
Error
False
None
True
What is the output? print("Hello" + " World")
"Hello" + " World"
Error
Hello World
HelloWorld
Which of the following is a valid way to create a list in Python?
list = (1, 2, 3)
list = <1, 2, 3>
list = [1, 2, 3]
list = {1, 2, 3}
What is the output? print(len("Python"))
5
6
Error
None
Which of the following is a valid way to create a dictionary in Python?
dict = (1, 2, 3)
dict = <1, 2, 3>
dict = {"key": "value"}
dict = [1, 2, 3]
