,WGU E010 Foundations of Programming
(Python) Practice Workbook
Section 1: Python Basics, Variables & Data
Types (Questions 1–12)
1. What is the output of the following Python
expression?
Python
print(10 // 3)
• A. 3.3333
• B. 3
• C. 4
• D. 3.0
Correct Answer: B
Rationale: The floor division operator (//) divides two
numbers and rounds down to the nearest integer,
discarding any fractional remainder.
2. Which of the following variable names is
illegal and will raise a SyntaxError in Python?
• A. total_score
• B. 2nd_place
• C. _user_name
• D. itemCount
Correct Answer: B
,Rationale: Variable names in Python cannot start
with a digit (2nd_place). They must begin with a
letter or an underscore.
3. What data type is returned by the expression
type() in Python 3?
• A. <class 'int'>
• B. <class 'str'>
• C. <class 'float'>
• D. <class 'double'>
Correct Answer: C
Rationale: In Python 3, standard division (/) always
returns a floating-point number, even if both
operands are integers and divide evenly.
4. What is the output of the following string
operation?
Python
word = "Python"
print(word[1:4])
• A. Pyt
• B. yth
• C. ytho
• D. ytho
Correct Answer: B
, Rationale: String slicing [start:stop] includes the
start index (1 → 'y') up to, but not including, the stop
index (4 → 'o'). Thus, indices 1, 2, and 3 yield "yth".
5. Which operator is used to calculate the
remainder of division (modulo) in Python?
• A. /
• B. //
• C. %
• D. **
Correct Answer: C
Rationale: The modulo operator (%) computes the
remainder of a division operation (e.g., 7 % 3 = 1).
6. What is the result of evaluating the boolean
expression True and False or True?
• A. True
• B. False
• C. None
• D. TypeError
Correct Answer: A
Rationale: Operator precedence evaluates and
before or. True and False evaluates to False. Then
False or True evaluates to True.
(Python) Practice Workbook
Section 1: Python Basics, Variables & Data
Types (Questions 1–12)
1. What is the output of the following Python
expression?
Python
print(10 // 3)
• A. 3.3333
• B. 3
• C. 4
• D. 3.0
Correct Answer: B
Rationale: The floor division operator (//) divides two
numbers and rounds down to the nearest integer,
discarding any fractional remainder.
2. Which of the following variable names is
illegal and will raise a SyntaxError in Python?
• A. total_score
• B. 2nd_place
• C. _user_name
• D. itemCount
Correct Answer: B
,Rationale: Variable names in Python cannot start
with a digit (2nd_place). They must begin with a
letter or an underscore.
3. What data type is returned by the expression
type() in Python 3?
• A. <class 'int'>
• B. <class 'str'>
• C. <class 'float'>
• D. <class 'double'>
Correct Answer: C
Rationale: In Python 3, standard division (/) always
returns a floating-point number, even if both
operands are integers and divide evenly.
4. What is the output of the following string
operation?
Python
word = "Python"
print(word[1:4])
• A. Pyt
• B. yth
• C. ytho
• D. ytho
Correct Answer: B
, Rationale: String slicing [start:stop] includes the
start index (1 → 'y') up to, but not including, the stop
index (4 → 'o'). Thus, indices 1, 2, and 3 yield "yth".
5. Which operator is used to calculate the
remainder of division (modulo) in Python?
• A. /
• B. //
• C. %
• D. **
Correct Answer: C
Rationale: The modulo operator (%) computes the
remainder of a division operation (e.g., 7 % 3 = 1).
6. What is the result of evaluating the boolean
expression True and False or True?
• A. True
• B. False
• C. None
• D. TypeError
Correct Answer: A
Rationale: Operator precedence evaluates and
before or. True and False evaluates to False. Then
False or True evaluates to True.