WGU E010 FOUNDATION OF PROGRAMMING (PYTHON)
OBJECTIVE ASSESSMENT EXAM – QUESTIONS AND ANSWERS |
EXAM TESTBANK WITH VERIFIED AND WELL DETAILED
ANSWERS | PLUS RATIONALES | DOWNLOAD AND PASS |
LATEST EXAM UPDATE 2026/2027
Question 1
Which symbol begins a single-line comment in Python?
• A. // (double forward slash)
• B. # (pound symbol)
• C. * (asterisk)
• D. % (percent symbol)
Correct Answer: B. # (pound symbol)
Detailed Rationale: In Python, the hash or pound symbol (#) is used to
designate single-line comments. Any text following the # on that line is
ignored by the Python interpreter during execution.
Question 2
Which data type best represents the value 3.14 in Python?
• A. Integer
• B. Float
• C. String
• D. Boolean
,Correct Answer: B. Float
Detailed Rationale: Numbers that contain a decimal point are classified
as floating-point numbers (float) in Python, whereas whole numbers are
categorized as integers (int).
Question 3
In Python, what type of element must follow the in keyword when
constructing a standard for loop?
• A. A condition
• B. An iterable object
• C. A numeric threshold
• D. A variable name definition
Correct Answer: B. An iterable object
Detailed Rationale: A for loop in Python iterates over members of a
sequence or collection, which are referred to as iterable objects (such
as lists, strings, tuples, dictionaries, or ranges).
Question 4
Which type of loop structure is designed specifically for iterating over a
sequence a predetermined number of times?
• A. while loop
• B. for loop
• C. infinite loop
• D. do-while loop
Correct Answer: B. for loop
,Detailed Rationale: The for loop iterates directly over items in a known
collection or sequence, making it ideal when the number of iterations is
explicit or bounded by an iterable length.
Question 5
Which components are required in every standard Python while loop?
• A. A condition and an indented code block
• B. A variable declaration and a return statement
• C. A counter increment and a break statement
• D. An explicit iterator and a target list
Correct Answer: A. A condition and an indented code block
Detailed Rationale: A while loop evaluates a boolean condition before
each iteration; as long as that condition remains true, the associated
indented code block executes repeatedly.
Question 6
Which keyword is used to exit a loop prematurely in Python, regardless
of the loop's condition?
• A. return
• B. break
• C. stop
• D. end
Correct Answer: B. break
, Detailed Rationale: The break statement immediately terminates the
execution of the innermost loop (either for or while), transferring
control to the statement immediately following the loop body.
Question 7
In the code snippet for item in my_list:, what does the variable item
represent during each iteration?
• A. The numeric index position of the current element
• B. The current element being processed from the list
• C. The total length or size of the list
• D. A reference to the entire list object
Correct Answer: B. The current element being processed
Detailed Rationale: As a for loop traverses a collection, the loop
variable (item) is assigned the value of the current element in the
sequence on each successive pass.
Question 8
A program processes file names and extracts the last 3 characters
representing the file extension (e.g., document.pdf and image.png).
Which string slicing approach works for extracting these extensions?
• A. filename[:9]
• B. filename[9:]
• C. filename[-3:]
• D. filename[:-3]
Correct Answer: C. filename[-3:]
OBJECTIVE ASSESSMENT EXAM – QUESTIONS AND ANSWERS |
EXAM TESTBANK WITH VERIFIED AND WELL DETAILED
ANSWERS | PLUS RATIONALES | DOWNLOAD AND PASS |
LATEST EXAM UPDATE 2026/2027
Question 1
Which symbol begins a single-line comment in Python?
• A. // (double forward slash)
• B. # (pound symbol)
• C. * (asterisk)
• D. % (percent symbol)
Correct Answer: B. # (pound symbol)
Detailed Rationale: In Python, the hash or pound symbol (#) is used to
designate single-line comments. Any text following the # on that line is
ignored by the Python interpreter during execution.
Question 2
Which data type best represents the value 3.14 in Python?
• A. Integer
• B. Float
• C. String
• D. Boolean
,Correct Answer: B. Float
Detailed Rationale: Numbers that contain a decimal point are classified
as floating-point numbers (float) in Python, whereas whole numbers are
categorized as integers (int).
Question 3
In Python, what type of element must follow the in keyword when
constructing a standard for loop?
• A. A condition
• B. An iterable object
• C. A numeric threshold
• D. A variable name definition
Correct Answer: B. An iterable object
Detailed Rationale: A for loop in Python iterates over members of a
sequence or collection, which are referred to as iterable objects (such
as lists, strings, tuples, dictionaries, or ranges).
Question 4
Which type of loop structure is designed specifically for iterating over a
sequence a predetermined number of times?
• A. while loop
• B. for loop
• C. infinite loop
• D. do-while loop
Correct Answer: B. for loop
,Detailed Rationale: The for loop iterates directly over items in a known
collection or sequence, making it ideal when the number of iterations is
explicit or bounded by an iterable length.
Question 5
Which components are required in every standard Python while loop?
• A. A condition and an indented code block
• B. A variable declaration and a return statement
• C. A counter increment and a break statement
• D. An explicit iterator and a target list
Correct Answer: A. A condition and an indented code block
Detailed Rationale: A while loop evaluates a boolean condition before
each iteration; as long as that condition remains true, the associated
indented code block executes repeatedly.
Question 6
Which keyword is used to exit a loop prematurely in Python, regardless
of the loop's condition?
• A. return
• B. break
• C. stop
• D. end
Correct Answer: B. break
, Detailed Rationale: The break statement immediately terminates the
execution of the innermost loop (either for or while), transferring
control to the statement immediately following the loop body.
Question 7
In the code snippet for item in my_list:, what does the variable item
represent during each iteration?
• A. The numeric index position of the current element
• B. The current element being processed from the list
• C. The total length or size of the list
• D. A reference to the entire list object
Correct Answer: B. The current element being processed
Detailed Rationale: As a for loop traverses a collection, the loop
variable (item) is assigned the value of the current element in the
sequence on each successive pass.
Question 8
A program processes file names and extracts the last 3 characters
representing the file extension (e.g., document.pdf and image.png).
Which string slicing approach works for extracting these extensions?
• A. filename[:9]
• B. filename[9:]
• C. filename[-3:]
• D. filename[:-3]
Correct Answer: C. filename[-3:]