WGU E010 Foundations of Programming (Python)
OA Final Exam | Complete Exam with Actual
Questions & Correct Verified Answers (Rationales
Included) | Latest Update 2026/2027 – Already
Graded A+
SECTION 1: BASIC SYNTAX & DATA TYPES
Question 1
What is the correct output of print("Hello, World!")?
A) "Hello, World!"
B) Hello, World!
C) print("Hello, World!")
D) An error occurs
Answer: B
Rationale: The print() function outputs the string literal to the console without the
quotation marks. The quotes are used only to denote the string in the code .
Question 2
Which symbol begins a single-line comment in Python?
A) // (double forward slash)
B) # (pound symbol)
C) * (asterisk)
D) % (percent symbol)
Answer: B
,Rationale: The hash character # indicates a single-line comment in Python.
Everything after it on the same line is ignored by the interpreter .
Question 3
Which of the following is a valid variable name in Python?
A) 2ndName
B) my-name
C) my_name
D) class
Answer: C
Rationale: Python variable names cannot start with a digit (eliminating 2ndName),
cannot contain hyphens (eliminating my-name), and cannot be reserved keywords
like class (eliminating class). Underscores are allowed and commonly used, so
my_name is valid .
Question 4
Which data type is the value 3.14 in Python?
A) Integer
B) Float
C) String
D) Boolean
Answer: B
Rationale: Numbers with a decimal point are of type float (floating-point). Integers
have no decimal point .
Question 5
,What is the output of print(type())?
A) <class 'int'>
B) <class 'float'>
C) <class 'double'>
D) <class 'str'>
Answer: B
Rationale: In Python, the / operator performs true division and always returns a
float, even when the numbers divide evenly. = 5.0, so type(5.0) returns float.
Python does not have a separate double type .
Question 6
Which data type is immutable?
A) list
B) dict
C) set
D) tuple
Answer: D
Rationale: A tuple cannot be changed after creation (immutable). Lists,
dictionaries, and sets are mutable data types that can be modified after creation .
Question 7
What will the following code print?
python
x = "Hello"
print(x[1])
, A) H
B) e
C) l
D) o
Answer: B
Rationale: String indexing in Python starts at 0. Index 0 is 'H', index 1 is 'e'. The
code prints the character at index 1, which is 'e' .
Question 8
What is the output of print(2 ** 3)?
A) 6
B) 8
C) 9
D) 5
Answer: B
Rationale: The ** operator is the exponentiation operator. 2 ** 3 means 2 raised
to the power of 3, which equals 8 .
Question 9
What is the result of 10 // 3?
A) 3.33
B) 3
C) 4
D) 3.5
Answer: B
Rationale: The floor division operator // returns the integer quotient (discards
remainder). 10 // 3 = 3 .
OA Final Exam | Complete Exam with Actual
Questions & Correct Verified Answers (Rationales
Included) | Latest Update 2026/2027 – Already
Graded A+
SECTION 1: BASIC SYNTAX & DATA TYPES
Question 1
What is the correct output of print("Hello, World!")?
A) "Hello, World!"
B) Hello, World!
C) print("Hello, World!")
D) An error occurs
Answer: B
Rationale: The print() function outputs the string literal to the console without the
quotation marks. The quotes are used only to denote the string in the code .
Question 2
Which symbol begins a single-line comment in Python?
A) // (double forward slash)
B) # (pound symbol)
C) * (asterisk)
D) % (percent symbol)
Answer: B
,Rationale: The hash character # indicates a single-line comment in Python.
Everything after it on the same line is ignored by the interpreter .
Question 3
Which of the following is a valid variable name in Python?
A) 2ndName
B) my-name
C) my_name
D) class
Answer: C
Rationale: Python variable names cannot start with a digit (eliminating 2ndName),
cannot contain hyphens (eliminating my-name), and cannot be reserved keywords
like class (eliminating class). Underscores are allowed and commonly used, so
my_name is valid .
Question 4
Which data type is the value 3.14 in Python?
A) Integer
B) Float
C) String
D) Boolean
Answer: B
Rationale: Numbers with a decimal point are of type float (floating-point). Integers
have no decimal point .
Question 5
,What is the output of print(type())?
A) <class 'int'>
B) <class 'float'>
C) <class 'double'>
D) <class 'str'>
Answer: B
Rationale: In Python, the / operator performs true division and always returns a
float, even when the numbers divide evenly. = 5.0, so type(5.0) returns float.
Python does not have a separate double type .
Question 6
Which data type is immutable?
A) list
B) dict
C) set
D) tuple
Answer: D
Rationale: A tuple cannot be changed after creation (immutable). Lists,
dictionaries, and sets are mutable data types that can be modified after creation .
Question 7
What will the following code print?
python
x = "Hello"
print(x[1])
, A) H
B) e
C) l
D) o
Answer: B
Rationale: String indexing in Python starts at 0. Index 0 is 'H', index 1 is 'e'. The
code prints the character at index 1, which is 'e' .
Question 8
What is the output of print(2 ** 3)?
A) 6
B) 8
C) 9
D) 5
Answer: B
Rationale: The ** operator is the exponentiation operator. 2 ** 3 means 2 raised
to the power of 3, which equals 8 .
Question 9
What is the result of 10 // 3?
A) 3.33
B) 3
C) 4
D) 3.5
Answer: B
Rationale: The floor division operator // returns the integer quotient (discards
remainder). 10 // 3 = 3 .