




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































WGU E010 Foundations of Programming (Python) – 250 Practice Questions & Rationales Below is a comprehensive set of 250 scenario-based multiple-choice questions for the WGU E010 Foundations of Programming (Python) Objective Assessment , updated for the 2026 testing cycle. Each question is >15 words and includes the correct answer with a detailed rationale in italics. Exam Details: Course: E010 Foundations of Programming (Python) Exam Type: Objective Assessment (OA) – Proctored Format: Multiple choice, code completion, debugging Key Topics: Variables & Data Types, Conditionals, Loops, Functions, Lists, Dictionaries, File I/O, Exception Handling, String Operations
Preparation Tip: The exam tests practical coding skills, not just syntax recognition SECTION 1: BASIC SYNTAX & DATA TYPES (Questions 1-50) Question 1 What is the output of print(type(10 / 2))? A) B) C) D) Answer: B – In Python, the / operator performs true division and always returns a float, even when the numbers divide evenly. 10 / 2 = 5.0, so type(5.0) is . Question 2 Which of the following data types is immutable in Python? A) list B) dict C) set D) tuple Answer: D – A tuple cannot be changed after creation (immutable).
Answer: B – The ** operator is the exponentiation operator. 2 ** 3 means 2 raised to the power of 3, which equals 8. Question 5 Which type of loop is best used when the number of iterations is unknown? A) for loop B) while loop C) nested loop D) for-each loop Answer: B – A while loop runs until a condition becomes False, making it ideal when the number of iterations is not known in advance. Question 6 What does the break statement do in a loop? A) Skips the current iteration B) Exits the loop completely C) Restarts the loop from the beginning D) Pauses the loop temporarily Answer: B – The break statement immediately terminates the loop entirely, not just skipping to the next iteration. Question 7 What is the output of print(3 + 2 * 4)?
Answer: C – Operator precedence: multiplication before addition. 2 * 4 = 8 , then 3 + 8 = 11_._ Question 8 Which function is used to get user input in Python? A) input("Enter name: ") B) scan("Enter name: ") C) get_input("Enter name: ") D) console.read("Enter name: ") Answer: A – The built-in input() function displays the optional prompt and returns the user's input as a string. Question 9 What does len("Programming") return? A) 10 B) 11 C) 12 D) 9
Answer: A – The modulo operator % returns the remainder. 15 ÷ 4 = 3 with a remainder of 3. Question 13 What is the result of 15 // 4? A) 3 B) 3. C) 4 D) 15 Answer: A – The // operator performs floor division (integer division). 15 ÷ 4 = 3.75, but // returns the integer part, which is 3. Question 14 Which of the following is a valid variable name in Python? A) 2nd_place B) my_var C) my-var D) class Answer: B – Variable names must start with a letter or underscore,
cannot contain hyphens, and cannot be a reserved keyword ( class is a keyword). my_var is valid. Question 15 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 – In Python, variables are created using the assignment operator =. The correct syntax is age = 25_._ Question 16 What is the output of print(int(3.9))? A) 3. B) 4 C) 3 D) Error Answer: C – The int() function truncates the decimal portion, converting 3.9 to 3_._ Question 17 Which of the following is NOT a valid Python data type?
Answer: B – The continue statement skips the remaining code in the current iteration and moves to the next iteration of the loop. Question 20 What is the output of print("The answer is " + 42)? A) The answer is 42 B) The answer is 42 (no quotes) C) TypeError: can only concatenate str (not "int") to str D) The answer is 42. Answer: C – You cannot concatenate a string and an integer directly in Python. The + operator requires both operands to be the same type. Question 21 Which of the following is a Boolean value in Python? A) "True" B) true C) True D) 1 Answer: C – Python's Boolean values are True and False (capitalized). "True" is a string, true is not valid, and 1 is an integer. Question 22 What is the output of print(3 ** 3)?
Answer: B – The ** operator performs exponentiation. 3 ** 3 means 3 × 3 × 3 = 27. Question 23 Which of the following is the correct way to create a multi-line string in Python? A) "This is a multi-line string" B) '''This is a multi-line string''' C) "This is a multi-line \ string" D) "This is a multi-line" + "string" Answer: B – Triple quotes ( ''' or """ ) are used to create multi-line strings in Python. Question 24 What is the output of print(type(True))? A) B) C)
D) Answer: C – The # symbol is used for single-line comments in Python. // and /* */ are used in other languages. Question 27 What is the output of print(bool([]))? A) True B) False C) None D) Error Answer: B – Empty containers (list, dict, set, tuple, string) evaluate to False in a boolean context. Non-empty containers are True_._ Question 28 What is the output of print(float(5))? A) 5 B) 5. C) "5" D) Error Answer: B – The float() function converts an integer (or string) to a floating-point number. float(5) returns 5.. Question 29 Which of the following correctly converts the string "123" to an integer?
A) int("123") B) int("123") C) str(123) D) float("123") Answer: A – int() converts a string (or float) to an integer. str() converts to string, float() to floating point. Question 30 What is the output of print(2 * 3)? A) 5 B) 6 C) 23 D) 8 Answer: B – The * operator performs multiplication when both operands are numbers. 2 * 3 = 6_._ Question 31 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 – Backticks are not used for strings in Python; they are used
Answer: A – The modulo operator % returns the remainder. 10 ÷ 3 = 3 with a remainder of 1. Question 35 Which of the following is a mutable data type in Python? A) tuple B) str C) int D) list Answer: D – Lists are mutable, meaning their elements can be changed after creation. Tuples, strings, and integers are immutable. Question 36 What is the output of print(5 ** 2)? A) 7 B) 10 C) 25 D) 5. Answer: C – The ** operator performs exponentiation. 5 ** 2 = 25_._
Question 37 Which operator is used for string concatenation in Python? A) & B) + C). D) , Answer: B – The + operator is used for string concatenation in Python. Question 38 What is the output of print(10 > 5 and 5 > 3)? A) True B) False C) None D) Error Answer: A – Both conditions are True, and the and operator returns True when both operands are True. Question 39 What is the output of print(10 > 5 or 5 > 7)? A) True B) False C) None D) Error
A) HelloHelloHello B) Hello Hello Hello C) Error D) Hello Answer: A – Multiplying a string by an integer repeats the string that many times. Question 43 Which of the following is a valid way to check if a variable x is equal to 5? A) x = 5 B) x == 5 C) x != 5 D) x is 5 Answer: B – == is the equality comparison operator. = is assignment, != is not equal, and is checks identity. Question 44 What is the output of print(type(42))? A) B) C)
D) Answer: A – 42 is an integer, so its type is . Question 45 Which of the following is a valid Python escape sequence? A) \n B) \newline C) \N D) \nl Answer: A – \n is the escape sequence for newline. Python uses backslash \ to introduce special characters. Question 46 What is the output of print("Hello\nWorld")? A) Hello World B) Hello\nWorld C) Hello World D) HelloWorld Answer: C – \n inserts a newline character, so "Hello" and "World" are printed on separate lines. Question 47 Which of the following is a valid way to create a variable named _temp?