menu

Python Variables and Data Types

Python Variables and Data Types - Important Points


1.

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

A. Integer

B. Real

C. Complex

D. All of the above

Discuss Work Space

Answer: option d

Explanation:

Python supports several data types, including integers, floating-point numbers, complex numbers, and others.


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

A. 9

B. 9

C. Error

D. None of the above

Discuss Work Space

Answer: option b

Explanation:

When you add an integer and a floating-point number in Python, the result is a floating-point number.

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

A. my_variable

B. 123variable

C. _my_variable

D. myVariable

Discuss Work Space

Answer: option b

Explanation:

Variable names in Python cannot start with a number.

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

A. x = 5

B. 5 = x

C. x + 5

D. 5 + x

Discuss Work Space

Answer: option a

Explanation:

In Python, you assign a value to a variable using the = operator.

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

A. HelloWorld

B. Hello World

C. Hello+"World"

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

When you use the + operator with two strings in Python, they are concatenated together.


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