menu

Python Variables and Data Types


1.

What is the output of the following code?

num = 2.5
print(type(num))

2.5

'2.5'

float

str


2. What is the result of the expression 10 % 3 in Python?

3.3333

3

1

0.3333


3.

What is the output of the following code?

num = 5
print(type(num))

5

'5'

int

str


4. Which of the following is not a valid Python data type?

Complex

Byte

Long

Double


5. Which of the following is not a valid variable name in Python?

my_variable

123variable

_my_variable

myVariable


6. Which of the following is a valid Boolean value in Python?

1

0

1

0


7.

What is the data type of the variable 'age' in the following code?
age = 25

Integer

String

Float

Boolean


8.

What is the data type of the variable 'name' in the following code?
name = "John Doe"

Integer

String

Float

Boolean


9. Which of the following is not a valid Python variable name?

my_variable

myVariable

1variable

_variable


10. What is the result of the expression 4 + 5.0 in Python?

9

9

Error

None of the above