COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
type ‘int’
|
|
type ‘type’
|
|
error
|
|
0
|
Detailed explanation-1: -Answer: The type( ) function returns the class type of the object passed as parameter. So, type(type(int)) will return the class ‘type’. So, the correct answer is (b).
Detailed explanation-2: -The type() function is used to get the type of an object. Python type() function syntax is: type(object) type(name, bases, dict) When a single argument is passed to the type() function, it returns the type of the object. Its value is the same as the object.
Detailed explanation-3: -Answer: So the output is type ‘type’.
Detailed explanation-4: -How to Print the Type of a Variable in Python. To get the type of a variable in Python, you can use the built-in type() function. In Python, everything is an object. So, when you use the type() function to print the type of the value stored in a variable to the console, it returns the class type of the object.
Detailed explanation-5: -type(1/2) will return type float.