CS113 Introduction to Programming
Midterm Exam Review (Qns & Ans)
2025
1. Which programming paradigm emphasizes objects that
contain both data and methods?
A. Procedural programming
B. Functional programming
C. Object-oriented programming
D. Logic programming
ANS: C. Object-oriented programming
Rationale: Object-oriented programming organizes code into
objects, combining data and behavior, making it modular and
reusable.
2. What is the primary purpose of an algorithm in programming?
©2025
, A. To store data persistently
B. To serve as a blueprint for writing code
C. To provide a sequence of steps for solving problems
D. To display user interface elements
ANS: C. To provide a sequence of steps for solving problems
Rationale: Algorithms define structured procedures to achieve
specific outcomes efficiently.
3. Which of the following data types is typically used to store a
sequence of characters?
A. Integer
B. String
C. Boolean
D. Float
ANS: B. String
Rationale: Strings hold textual data represented as a sequence
of characters.
4. What is the output of the following Python code snippet:
`print(2 3)`?
A. 5
B. 6
©2025
, C. 8
D. 9
ANS: C. 8
Rationale: The ` ` operator represents exponentiation, and `2
3` calculates 2 raised to the power of 3.
5. What is the role of a compiler in programming?
A. Translates high-level code into machine code
B. Debugs runtime errors
C. Executes code line by line
D. Provides storage for variables
ANS: A. Translates high-level code into machine code
Rationale: Compilers convert programming languages into
executable machine code for hardware processing.
---
Fill-in-the-Blank Questions
6. ________ programming involves using functions that avoid
changing state and operate solely on inputs to produce outputs.
ANS: Functional
©2025
, Rationale: Functional programming relies on immutable data
and pure functions.
7. A loop that repeats indefinitely unless terminated by a specific
condition is called an ________ loop.
ANS: Infinite
Rationale: Infinite loops occur when the termination condition
is never met.
8. The process of finding and fixing errors in a program is
known as ________.
ANS: Debugging
Rationale: Debugging ensures the program functions correctly
by addressing runtime or syntax errors.
9. In programming, a ________ is a collection of related data
stored in a single variable and accessed using an index.
ANS: Array
Rationale: Arrays organize multiple items in a sequential and
indexed format.
10. The ________ operator is used to compare two values for
equality in most programming languages.
©2025
Midterm Exam Review (Qns & Ans)
2025
1. Which programming paradigm emphasizes objects that
contain both data and methods?
A. Procedural programming
B. Functional programming
C. Object-oriented programming
D. Logic programming
ANS: C. Object-oriented programming
Rationale: Object-oriented programming organizes code into
objects, combining data and behavior, making it modular and
reusable.
2. What is the primary purpose of an algorithm in programming?
©2025
, A. To store data persistently
B. To serve as a blueprint for writing code
C. To provide a sequence of steps for solving problems
D. To display user interface elements
ANS: C. To provide a sequence of steps for solving problems
Rationale: Algorithms define structured procedures to achieve
specific outcomes efficiently.
3. Which of the following data types is typically used to store a
sequence of characters?
A. Integer
B. String
C. Boolean
D. Float
ANS: B. String
Rationale: Strings hold textual data represented as a sequence
of characters.
4. What is the output of the following Python code snippet:
`print(2 3)`?
A. 5
B. 6
©2025
, C. 8
D. 9
ANS: C. 8
Rationale: The ` ` operator represents exponentiation, and `2
3` calculates 2 raised to the power of 3.
5. What is the role of a compiler in programming?
A. Translates high-level code into machine code
B. Debugs runtime errors
C. Executes code line by line
D. Provides storage for variables
ANS: A. Translates high-level code into machine code
Rationale: Compilers convert programming languages into
executable machine code for hardware processing.
---
Fill-in-the-Blank Questions
6. ________ programming involves using functions that avoid
changing state and operate solely on inputs to produce outputs.
ANS: Functional
©2025
, Rationale: Functional programming relies on immutable data
and pure functions.
7. A loop that repeats indefinitely unless terminated by a specific
condition is called an ________ loop.
ANS: Infinite
Rationale: Infinite loops occur when the termination condition
is never met.
8. The process of finding and fixing errors in a program is
known as ________.
ANS: Debugging
Rationale: Debugging ensures the program functions correctly
by addressing runtime or syntax errors.
9. In programming, a ________ is a collection of related data
stored in a single variable and accessed using an index.
ANS: Array
Rationale: Arrays organize multiple items in a sequential and
indexed format.
10. The ________ operator is used to compare two values for
equality in most programming languages.
©2025