Python Variables and Data Types
Python Variables and Data Types - Important Points
11. | What is the output of the following code? num = 2.5 print(type(num)) |
---|
A. 2.5
B. '2.5'
C. float
D. str
View Answer Discuss Work SpaceAnswer: option c
Explanation:
The code assigns the float value of 2.5 to the variable 'num', and then prints the data type of the variable, which is 'float'.
12. | What is the data type of the variable 'is_true' in the following code? |
---|
A. Integer
B. String
C. Boolean
D. Float
View Answer Discuss Work SpaceAnswer: option c
Explanation:
13. | What is the data type of the variable "x" in the following statement: x = 5.0? |
---|
A. Integer
B. Float
C. String
D. Boolean
View Answer Discuss Work SpaceAnswer: option b
Explanation:
14. | Which of the following is not a valid Python variable name? |
---|
A. my_variable
B. myVariable
C. 1variable
D. _variable
View Answer Discuss Work SpaceAnswer: option c
Explanation:
15. | What is the value of x after the following code is executed: x = 10 % 3 |
---|
A. 1
B. 2
C. 3
D. 4
View Answer Discuss Work SpaceAnswer: option a
Explanation: