Page 1 of 34
PROGRAMMING (PYTHON) OA 2026
MIDTERM EXAM COMPLETE (100) CURRENT
TESTING QUESTIONS AND CORRECT
ANSWERS
Ace the WGU E010 Foundations of Programming (Python) OA midterm Exam
with practice questions covering variables, data types, input/output, arithmetic
operators, strings, lists, dictionaries, conditionals, loops, functions, and basic
debugging. This study guide helps reinforce foundational coding concepts and
supports effective preparation for objective assessments. Designed to improve
problem-solving skills and boost confidence in Python programming.
Suitable for computer science, IT, and programming students.
Multiple choice.
Section 1: Variables, Data Types & Type Conversion
1. Which of the following is a valid variable name in Python?
A) 2ndVariable
B) my-var
C) _myVar
D) my var
Answer: C. _myVar
Explanation: Variable names cannot start with a digit (A), cannot
contain hyphens (B) or spaces (D). Underscore is allowed, including
at the beginning.
, Page 2 of 34
2. What is the data type of 3.14?
A) int
B) float
C) str
D) bool
Answer: B. float
Explanation: Numeric values with a decimal point are of type float.
Integers are whole numbers without a decimal point.
3. What is the output of print(type())?
A) <class 'int'>
B) <class 'float'>
C) <class 'double'>
D) <class 'complex'>
Answer: B. <class 'float'>
Explanation: In Python, the / operator always returns a floating-point result,
even when the division is exact.
4. Which of the following will convert the string "123" to an integer?
A) int("123")
B) str("123")
C) float("123")
D) bool("123")
Answer: A. int("123")
, Page 3 of 34
Explanation: The int() function converts a string (or other numeric
type) to an integer. "123" contains only digits, so conversion is valid.
5. What is the result of bool([]) in Python?
A) True
B) False
C) None
D) Error
Answer: B. False
Explanation: Empty sequences (lists, strings, tuples) and the number 0
evaluate to False in a Boolean context. Non-empty sequences evaluate
to True.
‘’z Section 2: Arithmetic & Comparison Operators
6. What is the output of print(3 + 5 * 2)?
A) 16
B) 13
C) 10
D) 11
Answer: B. 13
Explanation: Multiplication has higher precedence than addition. First 5 * 2
= 10, then 3 + 10 = 13.
7. What does the % operator do in Python?
A) Percent
, Page 4 of 34
B) Modulus – returns the remainder of division
C) Division
D) Exponentiation
Answer: B. Modulus – returns the remainder of division Explanation:
The modulus operator % gives the remainder after integer division. Example:
10 % 3 returns 1.
8. Which operator is used for floor division?
A) /
B) //
C) %
D) **
Answer: B. //
Explanation: Floor division (//) divides and rounds down to the nearest
integer. 10 // 3 equals 3.
9. What is the output of print(5 ** 2)?
A) 10
B) 7
C) 25
D) 32
Answer: C. 25
Explanation: ** is the exponentiation operator. 5 raised to the power of 2
equals 25.
10. Which comparison operator means “not equal to”?
PROGRAMMING (PYTHON) OA 2026
MIDTERM EXAM COMPLETE (100) CURRENT
TESTING QUESTIONS AND CORRECT
ANSWERS
Ace the WGU E010 Foundations of Programming (Python) OA midterm Exam
with practice questions covering variables, data types, input/output, arithmetic
operators, strings, lists, dictionaries, conditionals, loops, functions, and basic
debugging. This study guide helps reinforce foundational coding concepts and
supports effective preparation for objective assessments. Designed to improve
problem-solving skills and boost confidence in Python programming.
Suitable for computer science, IT, and programming students.
Multiple choice.
Section 1: Variables, Data Types & Type Conversion
1. Which of the following is a valid variable name in Python?
A) 2ndVariable
B) my-var
C) _myVar
D) my var
Answer: C. _myVar
Explanation: Variable names cannot start with a digit (A), cannot
contain hyphens (B) or spaces (D). Underscore is allowed, including
at the beginning.
, Page 2 of 34
2. What is the data type of 3.14?
A) int
B) float
C) str
D) bool
Answer: B. float
Explanation: Numeric values with a decimal point are of type float.
Integers are whole numbers without a decimal point.
3. What is the output of print(type())?
A) <class 'int'>
B) <class 'float'>
C) <class 'double'>
D) <class 'complex'>
Answer: B. <class 'float'>
Explanation: In Python, the / operator always returns a floating-point result,
even when the division is exact.
4. Which of the following will convert the string "123" to an integer?
A) int("123")
B) str("123")
C) float("123")
D) bool("123")
Answer: A. int("123")
, Page 3 of 34
Explanation: The int() function converts a string (or other numeric
type) to an integer. "123" contains only digits, so conversion is valid.
5. What is the result of bool([]) in Python?
A) True
B) False
C) None
D) Error
Answer: B. False
Explanation: Empty sequences (lists, strings, tuples) and the number 0
evaluate to False in a Boolean context. Non-empty sequences evaluate
to True.
‘’z Section 2: Arithmetic & Comparison Operators
6. What is the output of print(3 + 5 * 2)?
A) 16
B) 13
C) 10
D) 11
Answer: B. 13
Explanation: Multiplication has higher precedence than addition. First 5 * 2
= 10, then 3 + 10 = 13.
7. What does the % operator do in Python?
A) Percent
, Page 4 of 34
B) Modulus – returns the remainder of division
C) Division
D) Exponentiation
Answer: B. Modulus – returns the remainder of division Explanation:
The modulus operator % gives the remainder after integer division. Example:
10 % 3 returns 1.
8. Which operator is used for floor division?
A) /
B) //
C) %
D) **
Answer: B. //
Explanation: Floor division (//) divides and rounds down to the nearest
integer. 10 // 3 equals 3.
9. What is the output of print(5 ** 2)?
A) 10
B) 7
C) 25
D) 32
Answer: C. 25
Explanation: ** is the exponentiation operator. 5 raised to the power of 2
equals 25.
10. Which comparison operator means “not equal to”?