PROGRAMMING (PYTHON) 2026 – OA
PRACTICE QUESTIONS, VERIFIED ANSWERS
& DETAILED RATIONALES
WGU E010 FOUNDATIONS OF PROGRAMMING (PYTHON) 2026 – OA PRACTICE
QUESTIONS
• Comprehensive study resource: 300 verified practice questions with detailed
rationales designed to mirror the actual OA exam structure and difficulty level
• Effective preparation tool: Study by working through each question, checking
your answer against the highlighted correct option, and reviewing rationales to
reinforce conceptual understanding
1. What is the correct way to declare a variable in Python that stores the
number 42?
A) var x = 42
B) x == 42
C) x = 42
D) declare x = 42
E) x: int = 42;
CORRECT ANSWER: C) x = 42
In Python, variables are assigned values using the single equals sign (=). The other
options show syntax from other programming languages or use incorrect Python
syntax. Option A shows JavaScript syntax, B uses a comparison operator, D uses a
declaration keyword that doesn't exist in Python, and E includes a semicolon which
is not required in Python.
2. Which of the following is a valid Python data type?
,A) string
B) number
C) boolean
D) float
E) whole
CORRECT ANSWER: D) float
Python has several built-in data types including int, float, str, bool, and complex.
While "string," "boolean," and "number" are conceptual terms, they are not the
actual Python data type names. "Float" is the correct Python data type for decimal
numbers. "Whole" is not a valid Python data type.
3. What will be the output of the following code? x = 5; y = 2; print(x ** y)
A) 7
B) 10
C) 25
D) 32
E) 2.5
CORRECT ANSWER: C) 25
The ** operator in Python is the exponentiation operator. It raises the first number
to the power of the second. Therefore, 5 ** 2 = 5 × 5 = 25. Option A is addition, B is
multiplication, D would be 2^5, and E is division.
4. Which statement correctly uses the modulo operator in Python?
A) result = 10 % 3
B) result = 10 & 3
,C) result = 10 @ 3
D) result = 10 # 3
E) result = 10 $ 3
CORRECT ANSWER: A) result = 10 % 3
The modulo operator (%) in Python returns the remainder of a division operation.
10 % 3 = 1. The other options use different operators: & is bitwise AND, @ is matrix
multiplication, # starts a comment, and $ is not a valid Python operator.
5. What is the correct syntax to create a comment in Python?
A) // This is a comment
B) # This is a comment
C) /* This is a comment */
D) -- This is a comment
E) ' This is a comment
CORRECT ANSWER: B) # This is a comment
Python uses the hash symbol (#) for single-line comments. The other options show
comment syntax from other languages: // is JavaScript/C++, /* */ is multi-line in
C/Java, and -- is SQL.
6. Which of the following correctly converts a string to an integer in Python?
A) parseInt("123")
B) int("123")
C) convert("123")
D) Integer("123")
E) str_to_int("123")
, CORRECT ANSWER: B) int("123")
The int() function is the correct built-in Python function for converting a string to an
integer. Option A is JavaScript syntax, C and E are not valid Python functions, and D
uses Java syntax with a capital I.
7. What will be printed by the following code? x = "Hello"; print(x[1])
A) H
B) e
C) l
D) o
E) Hello
CORRECT ANSWER: B) e
In Python, strings are indexed starting at 0. So index [0] is 'H', index [1] is 'e', index
[2] is 'l', and so on. The code accesses the character at index 1, which is 'e'.
8. Which operator is used for string concatenation in Python?
A) &
B) +
C) .
D) ,
E) |
CORRECT ANSWER: B) +
The plus sign (+) is used to concatenate strings in Python. For example, "Hello" +
"World" results in "HelloWorld". The other operators are used for different
purposes: & is bitwise AND, . is for attribute access, , is for separating values, and |
is bitwise OR.