menu

Python Variables and Data Types


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

1

2

3

4


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

HelloWorld

Hello World

Hello+"World"

None of the above


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

my_variable

myVariable

1variable

_variable


4. What is the data type of the variable "x" in the following statement: x = 5.0?

Integer

Float

String

Boolean


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

9

9

Error

None of the above


6.

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

Integer

Real

Complex

All of the above


7.

What is the output of the following code?

num = 2.5
print(type(num))

2.5

'2.5'

float

str


8. Which of the following is a valid way to assign a value to a variable in Python?

x = 5

5 = x

x + 5

5 + x


9.

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

Integer

String

Float

Boolean


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

my_variable

123variable

_my_variable

myVariable