Comprehensive Final Exam (Qns & Ans)
2025
Question 1 (Multiple Choice)
Question:
Which programming paradigm treats computation as the
evaluation of mathematical functions and emphasizes
immutability and lack of side effects?
A) Procedural Programming
B) Object-Oriented Programming
C) Functional Programming
D) Logic Programming
Correct ANS:
C) Functional Programming
©2025
, Rationale:
Functional programming focuses on pure functions where each
function, given the same input, returns the same output without
side effects. This paradigm contrasts with procedural or object-
oriented approaches that rely more on mutable state.
---
Question 2 (Fill in the Blank)
Question:
A function that always returns the same output for the same input
and produces no observable side effects is known as a ________
function.
Correct ANS:
pure
Rationale:
Pure functions are central to functional programming. Their
predictability and lack of side effects make them easier to test,
debug, and parallelize.
©2025
,---
Question 3 (True/False)
Question:
True/False: In Python, using a mutable object as a default
function argument can lead to unexpected behavior when the
function is called multiple times.
Correct ANS:
True
Rationale:
In Python, default arguments are evaluated only once at function
definition. If a mutable object (like a list or dictionary) is
modified during one call, subsequent calls will see that modified
object, which may lead to unintended consequences.
---
Question 4 (Multiple Response)
Question:
©2025
, Select all features that are hallmark characteristics of Object-
Oriented Programming (OOP):
A) Encapsulation
B) Inheritance
C) Recursion
D) Polymorphism
E) Exception Handling
Correct ANS:
A, B, D
Rationale:
OOP is defined by core concepts such as encapsulation (bundling
data with methods), inheritance (extending properties from a base
class), and polymorphism (using a unified interface for different
underlying forms). Recursion is a common algorithmic technique,
and exception handling is a language feature available in many
paradigms.
---
Question 5 (Multiple Choice)
©2025