menu

Python Variables and Data Types


1.

What is the output of the following code?

num = 5
print(type(num))

5

'5'

int

str


2.

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

Integer

String

Boolean

Float


3. What is the value of x after the following code is executed: x = 10 % 3

1

2

3

4


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

HelloWorld

Hello World

Hello+"World"

None of the above


5.

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

Integer

Real

Complex

All of the above


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

my_variable

123variable

_my_variable

myVariable


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. What is the result of the expression 10 % 3 in Python?

3.3333

3

1

0.3333


10. Which of the following data types is immutable?

List

Dictionary

Tuple

Set