menu

Python Variables and Data Types


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

my_variable

myVariable

1variable

_variable


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

my_variable

123variable

_my_variable

myVariable


3.

Which of the following is a valid data type in Python?

Integer

Real

Complex

All of the above


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

Complex

Byte

Long

Double


5.

What is the output of the following code?

num = 2.5
print(type(num))

2.5

'2.5'

float

str


6.

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

Integer

String

Float

Boolean


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

1

0

1

0


8. What is the result of the expression "Hello" + "World" in Python?

HelloWorld

Hello World

Hello+"World"

None of the above


9.

What is the data type of the variable 'is_true' in the following code?
is_true = True

Integer

String

Boolean

Float


10.

What is the output of the following code?

num = 5
print(type(num))

5

'5'

int

str