Exam Review 2026 | Questions & Correct Answers |
Graded A+
1. Describe the significance of using a colon at the end of control flow
statements in Python.
The colon is optional and can be omitted.
The colon signifies the end of the statement.
The colon is used to separate parameters in function definitions.
The colon indicates the start of a block of code that is controlled by
the statement.
2. What is the purpose of the .isdigit() method in Python?
To split a string into a list.
To convert a string to an integer.
To find the length of a string.
To check if all characters in a string are digits.
3. What is a "function" in Python?
A random block of code.
Named blocks of code designed to do a specific job.
A loop structure.
A set of values.
4. What is the output of the string concatenation operation 'Python' +
'Programming'?
'Python Programming'
, 'Programming'
'Python'
'PythonProgramming'
5. What type of data structure is represented by parentheses in Python?
Set
Dictionary
Tuple
List
6. Describe how a for-loop operates in Python and provide an example of its
syntax.
A for-loop in Python is used to manipulate strings by concatenating
them.
A for-loop in Python is used to define a function with parameters.
A for-loop in Python creates a conditional statement that runs only
once.
A for-loop in Python iterates over items of a sequence, executing a
block of code for each item. For example: 'for item in sequence:
do_something(item)'
7. F-strings are also called:
Formatted string expressions
Modulo formatted strings
Formatted string literals
Functional strings
,8. Describe the role of variables in Python programming.
Variables in Python store data values that can be referenced and
manipulated throughout the program.
Variables in Python are used only for mathematical operations.
Variables in Python are fixed and cannot change once defined.
Variables in Python are only used for string manipulation.
9. Describe how the input() function can be utilized in a Python program.
The input() function is used to display results on the screen.
The input() function is used to define functions.
The input() function creates a new variable in the program.
The input() function can be used to prompt the user for information,
which can then be processed by the program.
10. Describe how a while-loop functions in Python and provide an example of
its use.
A while-loop is used to define a new data structure.
A while-loop continues to execute its block of code until the
condition evaluates to false; for example, it can be used to iterate
until a counter reaches a certain value.
A while-loop is a method for importing libraries.
A while-loop executes a block of code only once regardless of the
condition.
11. Which of the following is an int in Python?
"10"
, 10.2
False
10
12. Which of the following is not built-in module in Python?
random
pi
math
os
13. When one is writing to a file with Python, using the "w" mode to open the file
_____.
writes over the entire file and erases any previous contents
checks for existing data in the file and raises an exception if any is
found
writes only within areas of the file that do not contain any data
writes new data at the end of the file
14. Describe the role of a class in object-oriented programming in Python.
A class serves as a template for creating objects, allowing for the
encapsulation of data and behavior in a structured way.
A class is a control flow statement that determines the execution path
of a program.
A class is used to define functions that can be reused throughout the
program.