WGU E010 Foundations of Programming
(Python) – 2026 UPDATED OA | 100 Questions
& Answers | GUARANTEED PASS Study Guide.
100-Question Practice Exam
1. Which of the following best describes Python?
A. A compiled language that requires a separate build step
B. An interpreted, high-level, general-purpose programming language
C. A low-level assembly language used for system programming
D. A markup language used for structuring web pages
Answer: B. An interpreted, high-level, general-purpose programming language
Rationale: Python is an interpreted language, meaning code is executed line-by-line without a separate
compilation step. It is high-level (abstracting away hardware details) and general-purpose (suitable for
many applications like web development, data science, and automation).
2. What is the primary purpose of a variable in Python?
A. To store a value in memory for later use
B. To define a new function
C. To create a loop structure
D. To import external modules
Answer: A. To store a value in memory for later use
Rationale: Variables act as named containers that hold data. You can assign a value to a variable and
then refer to it by name throughout your code, allowing you to store, retrieve, and manipulate data
efficiently.
3. Which of the following is a valid variable name in Python?
A. 2nd_place
B. my-variable
C. _private_var
D. class
Answer: C. _private_var
Rationale: Variable names can start with a letter or underscore (_), followed by letters, numbers, or
,2
underscores. They cannot start with a number (A), contain hyphens (B), or be reserved keywords
like class (D).
4. What will be the output of the following code?
python
x=5
y=2
print(x // y)
A. 2.5
B. 2
C. 1
D. 10
Answer: B. 2
Rationale: The // operator performs floor division (integer division), which returns the whole number
quotient without the remainder. 5 divided by 2 is 2.5, and the floor division result is 2.
5. What will be the output of the following code?
python
print(2 ** 3)
A. 5
B. 6
C. 8
D. 9
Answer: C. 8
*Rationale: The ** operator is the exponentiation operator. 2 ** 3 means 2 raised to the power of 3,
which is 2 × 2 × 2 = 8.*
6. What is the correct way to get input from a user and store it as a string?
A. input()
B. get_input()
C. read_line()
D. scan()
Answer: A. input()
Rationale: The built-in input() function reads a line of text from the user and returns it as a string. You
can optionally include a prompt string, e.g., name = input("Enter your name: ").
,3
7. What will be the data type of the variable age after this code runs?
python
age = input("Enter your age: ")
A. int
B. float
C. str
D. bool
Answer: C. str
Rationale: The input() function always returns a string, regardless of what the user types. If you need to
perform mathematical operations on the input, you must explicitly convert it using int() or float().
8. Which function converts a string to an integer?
A. str()
B. float()
C. int()
D. bool()
Answer: C. int()
Rationale: The int() function converts a compatible string or number to an integer. For
example, int("42") returns the integer 42.
9. What is the purpose of a comment in Python code?
A. To execute additional instructions
B. To make the code run faster
C. To explain the code and improve readability for humans
D. To define a new variable
Answer: C. To explain the code and improve readability for humans
Rationale: Comments are notes written for programmers. They are ignored by the Python interpreter and
have no effect on program execution. They help document the purpose of code, explain complex logic,
and make collaboration easier.
10. Which symbol is used for single-line comments in Python?
A. //
B. /* */
C. #
D. --
, 4
Answer: C. #
Rationale: Any text following the # symbol on the same line is treated as a comment and ignored by the
interpreter. For multi-line comments, you can use triple quotes (""" or ''').
11. What will be the output of the following code?
python
print(type(3.14))
A. <class 'int'>
B. <class 'float'>
C. <class 'str'>
D. <class 'bool'>
Answer: B. <class 'float'>
*Rationale: The number 3.14 contains a decimal point, making it a floating-point number (float).
The type() function returns the data type of the given value.*
12. Which of the following is a Boolean value?
A. "True"
B. 1
C. True
D. "False"
Answer: C. True
Rationale: Boolean values are True and False (capitalized, without quotes). They represent logical truth
values. "True" is a string, and 1 is an integer.
13. What is the result of the expression 10 % 3?
A. 3
B. 1
C. 3.33
D. 0
Answer: B. 1
Rationale: The modulo operator (%) returns the remainder of a division. 10 divided by 3 is 3 with a
remainder of 1.
14. What will be the output of the following code?
python