WGU E010 FOUNDATIONS OF PROGRAMMING (PYTHON) OA 2026 PRACTICE EXAM COMPLETE (100) CURRENT, Exams of Programming Languages

WGU E010 FOUNDATIONS OF PROGRAMMING (PYTHON) OA 2026 PRACTICE EXAM COMPLETE (100) CURRENT TESTING QUESTIONS AND CORRECT ANSWERS WITH DETAILED EXPLANATIONS|GUARANTEED PASS. PYTHON

Typology: Exams

2025/2026

Available from 06/21/2026

machariajames
machariajames 🇺🇸

5

(1)

1.3K documents

1 / 47

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1 of
50
WGU
E010
FOUNDATIONS
OF
PROGRAMMING
(PYTHON)
OA
2026
PRACTICE EXAM COMPLETE (100) CURRENT
TESTING QUESTIONS AND CORRECT
ANSWERS WITH DETAILED
EXPLANATIONS|GUARANTEED PASS.
PYTHON
Ace the WGU E010 Foundations of Programming (Python) OA
practice Exam with practice questions covering Python syntax,
data types, control structures, functions, data structures (lists,
tuples,
dictionaries, sets), file I/O, exception handling, modules, and
basic object-oriented programming. 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: Python Fundamentals s Syntax (Questions 1–15)
1. What is the correct output of the following Python code?
print("Hello,
World!")
A)Hello, World!
B)Hello, World!
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f

Partial preview of the text

Download WGU E010 FOUNDATIONS OF PROGRAMMING (PYTHON) OA 2026 PRACTICE EXAM COMPLETE (100) CURRENT and more Exams Programming Languages in PDF only on Docsity!

50

WGU E010 FOUNDATIONS OF

PROGRAMMING (PYTHON) OA 2026

PRACTICE EXAM COMPLETE (100) CURRENT

TESTING QUESTIONS AND CORRECT

ANSWERS WITH DETAILED

EXPLANATIONS|GUARANTEED PASS.

PYTHON

Ace the WGU E010 Foundations of Programming (Python) OA practice Exam with practice questions covering Python syntax, data types, control structures, functions, data structures (lists, tuples, dictionaries, sets), file I/O, exception handling, modules, and basic object-oriented programming. 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: Python Fundamentals s Syntax (Questions 1–15)

  1. What is the correct output of the following Python code? print("Hello, World!") A)Hello, World! B)Hello, World!

50 C)print("Hello, World!") D)An error occurs Answer: A. Hello, World! Explanation: The print() function outputs the string literal to the console without the quotation marks. The quotes are used only to denote the string.

  1. Which of the following is a valid variable name in Python? A)2_variable B)my-variable C)_myVariable D)my variable Answer: C. _myVariable Explanation: Variable names can start with a letter or underscore, cannot start with a digit, and cannot contain spaces or hyphens. Underscore is allowed.

  2. In Python, which symbol is used for single- line comments? A)// B)# C)/* D) 50 Answer: B. Explanation: type() returns the class of the object. 3. is a floating-point number, so the output indicates a float class.

  3. Which operator is used for exponentiation (power) in Python? A)^ B)** C)* D)// Answer: B. ** Explanation: ** is the exponentiation operator (e.g., 2 ** 3 equals 8). The ^ operator is used for bitwise XOR.

  4. What is the result of 17 // 5 in Python? A)3. B) 3 C) 4 D)3. Answer: B. 3 Explanation: // is the floor division operator; it returns the integer quotient, discarding the remainder (17 // 5 = 3). G. What is the output of print(10 % 3)? A)3. B) 1 C) 3 D) 10

50 Answer: B. 1 Explanation: % is the modulo operator; it returns the remainder of division (10 divided by 3 gives remainder 1).

  1. Which of the following correctly converts the string "123" to an integer? A)int("123") B)integer("123") C)str(123) D)"123".to_int() Answer: A. int("123") Explanation: The built-in int() function converts a string (or other numeric type) to an integer, provided the string represents a valid integer.
  2. What is the value of len("Python")? A) 5 B) 6 C) 7 D) 4 Answer: B. 6 Explanation: len() returns the number of characters in the string. "Python" has 6 characters: P, y, t, h, o, n.
  3. Which statement reads input from the user as a string? A)input("Enter name: ") B)read("Enter name: ")

50

  1. What does bool(0) return? A)True B)False C) 0 D)None Answer: B. False Explanation: In Python, numeric values: 0, 0.0, and complex zero evaluate to False in a Boolean context. All non-zero numbers evaluate to True. Section 2: Control Flow (if, elif, else, loops) (Questions 16–30)
  2. What is the output of the following code? pytho n x = 10 if x > 5: print("A ") elif x > 7: print("B ") else: print("C")

50 A)A B)B

Page G of 44 C) 6 D)infinite Answer: B. 5 Explanation: The loop starts with count = 0. It runs while count < 5. The loop body increments count. The iterations happen when count = 0,1,2,3,4 (5 times). When count becomes 5, the condition is False and the loop stops. 1G. What is the output of this for loop? python for i in range(3): print(i, end=" ") A) 0 1 2 B) 1 2 3 C) 0 1 2 3 D) 1 2 Answer: A. 0 1 2 Explanation: range(3) generates numbers 0, 1, and 2. The loop iterates three times, printing each number with a space after it.

  1. Which statement is used to exit a loop prematurely? A)exit B)stop C)break D)return

50 Answer: C. break Explanation: The break statement terminates the innermost loop (while or for) immediately and resumes execution after the loop.

  1. What is the output of the following code? python for i in range(1, 6, 2): print(i, end=" ") A) 1 2 3 4 5 B) 1 3 5 C) 2 4 6 D) 1 3 5 7 Answer: B. 1 3 5 Explanation: range(1, 6, 2) starts at 1, goes up to but not including 6, with a step of 2. So the values are 1, 3, and 5.
  2. Which of the following correctly checks if a number n is between 10 and 20 (inclusive)? A) 10 <= n <= 20 B)n >= 10 and n <= 20 C)Both A and B D)n in range(10,20) Answer: C. Both A and B Explanation: Python supports chained comparisons: 10 <= n

50 else: x = 0 A) 5 B) 10 C) 0 D)None Answer: B. 10 Explanation: The condition if x: treats x as a Boolean. Non-zero numbers are True, so the if branch executes, setting x to 10.

  1. Which of the following statements will skip the current iteration and continue with the next? A)break B)continue C)pass D)skip Answer: B. continue Explanation: continue jumps to the next iteration of the loop, skipping any remaining code in the current iteration. break exits the loop entirely.
  2. What is the output? python for i in range(3): if i == 1:

50 break print(i, end=" ") A) 0 B) 0 1 C) 0 1 2 D)No output Answer: A. 0 Explanation: When i = 0, condition false, print 0. When i = 1, i == 1 is True, break exits the loop immediately without printing 1 or further values.

  1. How many times will "Hello" be printed? pytho n i = 0 while i < 5: print("Hello ") i += 2 A) 2 B) 3 C) 4 D) 5 Answer: B. 3 Explanation: i starts 0 → print, i=2; i=2 → print, i=4; i=4 → print, i=6; now i=6 not <5, stop. Three prints.

50 Section 3: Functions s Scope (Questions 31–45)

  1. What is the output of the following code? python def greet(): return "Hi" print(greet()) A)greet B)Hi C)None D)Error Answer: B. Hi Explanation: The function greet() returns the string "Hi". The print function outputs that returned value.
  2. Which keyword is used to define a function in Python? A)func B)define C)def D)function Answer: C. def Explanation: The def keyword is followed by the function name, parentheses, and a colon. The function body is indented.
  3. What is the output of this code?

50 python def add(a, b): return a + b result = add(3, 4) print(result) A) 7 B) 12 C)add(3,4) D)Error Answer: A. 7 Explanation: The function takes two parameters and returns their sum. add(3,4) returns 7, which is assigned to result and printed.

  1. A variable defined inside a function is called a variable. A)global B)local C)static D)constant Answer: B. local Explanation: Variables declared inside a function have local scope; they are not accessible outside that function unless returned or passed.
  2. What is the output?

50 Explanation: If no return statement is executed, or a return with no value, the function returns None implicitly.

50

  1. What is the output of the following code? python def test(a, b=5): return a * b print(test(3)) A) 15 B) 8 C) 3 D)Error Answer: A. 15 Explanation: b has a default value of 5. The call test(3) assigns a=3, uses default b=5, and returns 3*5 = 15.
  2. What does *args do in a function definition? A)Defines a dictionary of keyword arguments B)Allows the function to accept an arbitrary number of positional arguments as a tuple C)Declares a global variable D)Performs argument unpacking for lists Answer: B. Allows the function to accept an arbitrary number of positional arguments as a tuple Explanation: *args (the name can be anything but * is the operator) collects extra positional arguments into a