Python Basics
Python Basics - Important Points
11. | Which of the following is NOT a data type in Python? |
---|
A. Integer
B. Float
C. Double
D. String
View Answer Discuss Work SpaceAnswer: option c
Explanation:
Python does not have a Double data type, but it has a Float data type.
12. | Which of the following is a valid Python variable name? |
---|
A. 1_name
B. my_variable
C. $test
D. class
View Answer Discuss Work SpaceAnswer: option b
Explanation:
Python variable names must start with a letter or underscore, and can contain letters, numbers, and underscores.
13. | Which of the following is NOT a valid way to declare a variable in Python? |
---|
A. x = 1
B. y = "Hello"
C. z = 3.14
D. 2 = a
View Answer Discuss Work SpaceAnswer: option d
Explanation:
Variables cannot be declared with a numeric value on the left side of the equals sign.
14. | Which of the following is the correct way to define a multi-line string in Python? |
---|
A. This is a multi-line string
B. '''This is a multi-line string'''
C. "This is a multi-line string"
D. All of the above
View Answer Discuss Work SpaceAnswer: option c
Explanation:
Triple quotes are used to define multi-line strings in Python.
15. | Which of the following is an example of a mutable data type in Python? |
---|
A. Integer
B. Float
C. String
D. List
View Answer Discuss Work SpaceAnswer: option d
Explanation:
Lists in Python are mutable, which means their values can be changed.