Python Programming Practice Test/Answer Key!!
Section 1: Multiple Choice Questions
1. Which of the following is not a valid variable name in Python?
a) myVariable
b) _myVariable
c) 1myVariable
d) my_variable
2. What will be the output of the following code snippet?
my_list = [1, 2, 3, 4, 5]
print(my_list[1:3])
a) [2, 3]
b) [1, 2]
c) [2, 4]
d) [1, 3]
3. Which of the following is used to create a comment in Python?
a) //
b) --
c) #
d) /* */
4. What is the result of 10 // 3 in Python?
a) 3
b) 3.33
c) 3.0
d) 3.3
5. Which of the following is a mutable data type in Python?
a) Tuple
b) String
c) List
d) Set
Section 2: True or False
6. Python is a statically typed language.
- True
Section 1: Multiple Choice Questions
1. Which of the following is not a valid variable name in Python?
a) myVariable
b) _myVariable
c) 1myVariable
d) my_variable
2. What will be the output of the following code snippet?
my_list = [1, 2, 3, 4, 5]
print(my_list[1:3])
a) [2, 3]
b) [1, 2]
c) [2, 4]
d) [1, 3]
3. Which of the following is used to create a comment in Python?
a) //
b) --
c) #
d) /* */
4. What is the result of 10 // 3 in Python?
a) 3
b) 3.33
c) 3.0
d) 3.3
5. Which of the following is a mutable data type in Python?
a) Tuple
b) String
c) List
d) Set
Section 2: True or False
6. Python is a statically typed language.
- True