200 Practice Questions
Description: This is a 200-question practice bank covering the WGU E010 Foundations of
Programming (Python) Objective Assessment, aligned with the 2026 course competencies.
Questions span variables and data types, control flow, loops, functions, data structures, string
manipulation, file I/O, exception handling, and debugging. Each question includes a correct
answer and rationale. This is an independent study resource, not official WGU exam content.
Format: 200 multiple-choice questions | Domains: Syntax & Basic Operations (30%), Code
Execution (17%), Data Structures (23%), Functional Programs (30%)
Section 1: Variables, Data Types & Basic Operations (Questions 1–40)
1. What is the correct way to create a variable named age with the value 25 in Python?
A) age == 25
B) age := 25
C) age = 25
D) int age = 25
Answer: C
Rationale: Python uses = for assignment. No type declaration is needed. == is comparison, := is
the walrus operator (for expressions), and int age = 25 is invalid Python syntax.
2. Which of the following is a valid Boolean value in Python?
A) "True"
B) 'true'
C) True
D) '1'
Answer: C
Rationale: Python Boolean values are True and False, capitalized. "True" is a string, 'true' is not
a keyword (case-sensitive), and '1' is a string.
3. What is the output of bool(0)?
A) True
B) False
C) 0
D) None
,Answer: B
Rationale: 0 is considered False in a Boolean context. Any non-zero number is True.
4. What is the output of bool("") (empty string)?
A) True
B) False
C) ""
D) Error
Answer: B
Rationale: An empty string is considered False in a Boolean context. Non-empty strings are
True.
5. Which of the following is NOT a valid Python variable name?
A) my_var
B) myVar
C) True
D) _my_var
Answer: C
Rationale: True and False are reserved keywords in Python and cannot be used as variable
names.
6. Which symbol begins a single-line comment in Python?
A) //
B) #
C) *
D) %
Answer: B
Rationale: The pound symbol # begins a single-line comment in Python. // is floor division.
7. Which data type is the value 3.14 in Python?
A) Integer
B) Float
C) String
D) Boolean
Answer: B
Rationale: Numbers with a decimal point are of type float (floating-point). Integers have no
decimal point.
8. What is the data type of the value 42 in Python?
,A) Float
B) String
C) Integer
D) Boolean
Answer: C
Rationale: Whole numbers without a decimal point are integers (int).
9. What is the output of print(type())?
A) <class 'int'>
B) <class 'float'>
C) <class 'double'>
D) <class 'str'>
Answer: B
Rationale: In Python 3, the / operator performs true division and always returns a float, even
when numbers divide evenly. = 5.0, so type(5.0) is <class 'float'>.
10. Given x = 5 and y = 2, what is the result of x // y?
A) 2.5
B) 2
C) 3
D) 1
Answer: B
Rationale: The floor division operator // returns the integer quotient (discards the remainder).
5 // 2 = 2. This is distinct from true division (/), which returns a float.
11. What is the output of print(2 ** 3)?
A) 6
B) 8
C) 9
D) 5
Answer: B
Rationale: The ** operator performs exponentiation. 2 ** 3 means 2 raised to the power of 3,
which equals 8.
12. What is the output of print(3 + 2 * 4)?
A) 20
B) 14
, C) 11
D) 24
Answer: C
Rationale: Multiplication has higher precedence than addition. 2 * 4 = 8, then 3 + 8 = 11.
13. Which operator is used to check if two values are equal in Python?
A) =
B) ==
C) !=
D) ===
Answer: B
Rationale: == is the equality comparison operator. = is assignment. != means "not equal." === is
not valid in Python.
14. Which of the following correctly converts the string "123" to an integer?
A) int("123")
B) str("123")
C) float("123")
D) "123".to_int()
Answer: A
Rationale: The int() function converts a string of digits to an integer.
15. What is the correct way to output the string "Hello, World!"?
A) print("Hello, World!")
B) console.log("Hello, World!")
C) echo "Hello, World!"
D) printf("Hello, World!")
Answer: A
Rationale: Python's built-in print() function outputs text to the console.
16. Which of the following is NOT a valid way to create a string in Python?
A) 'hello'
B) "hello"
C) `hello`
D) '''hello'''
Answer: C
Rationale: Backticks are not used for strings in Python. Single quotes, double quotes, and triple
quotes are valid.