menu

Python Variables and Data Types

Python Variables and Data Types - Important Points


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

A. 1

B. 0

C. 1

D. 0

Discuss Work Space

Answer: option c

Explanation:

In Python, Boolean values are True and False (with uppercase T and F).

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

A. 3.3333

B. 3

C. 1

D. 0.3333

Discuss Work Space

Answer: option c

Explanation:

The % operator in Python returns the remainder of a division operation.

8.

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

A. Integer

B. String

C. Float

D. Boolean

Discuss Work Space

Answer: option a

Explanation:

The variable 'age' is assigned an integer value of 25, hence the data type is integer.

9.

What is the output of the following code?

num = 5
print(type(num))

A. 5

B. '5'

C. int

D. str

Discuss Work Space

Answer: option c

Explanation:

The code assigns the integer value of 5 to the variable 'num', and then prints the data type of the variable, which is 'int'.


10.

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

A. Integer

B. String

C. Float

D. Boolean

Discuss Work Space

Answer: option b

Explanation:

The variable 'name' is assigned a string value of "John Doe", hence the data type is string.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now