IT313
Intermediate Programming
Comprehensive Finals Review (Qns & Ans)
2025
1. Which of the following best describes polymorphism in
object-oriented programming?
a) The ability of different classes to be viewed as instances of
the same class through inheritance.
b) Encapsulation of data and functions that manipulate the data.
c) The capacity of a single function name to be used for
different types of arguments.
©2024/2025
, d) A means of organizing code for better structure and
readability.
ANS: a)
Rationale: Polymorphism allows objects of different classes
to be treated as objects of a common superclass, particularly
through a shared interface.
2. What is the primary advantage of using recursion over
iteration in some programming scenarios?
a) Easier to implement and understand for all types of problems.
b) Generally more memory efficient than iteration.
c) Suits problems where the outcome is naturally expressed in
recursive calls more clearly.
d) Allows for more extensive error handling.
©2024/2025
, ANS: c)
Rationale: Recursion often provides a clearer and more direct
approach to problems that have overlapping subproblems or a
lattice structure, such as sorting algorithms like quicksort or
merge sort.
3. When implementing concurrency in programming, which
model is designed to handle many small subtasks collectively
within a single larger task?
a) Thread-based concurrency
b) Process-based concurrency
c) Asynchronous programming
d) Task-based concurrency
ANS: d)
©2024/2025
, Rationale: Task-based concurrency allows for splitting larger
processes into smaller tasks, which can be handled concurrently to
improve efficiency and manage resources better.
4. In context with exception handling in Java, the 'finally' block
is used to:
a) Close resources like files and connections that must be closed
regardless of exceptions.
b) Handle specific exceptions and provide alternative actions.
c) Catch the most specific exception that has occurred.
d) Modify the exception message before propagation.
ANS: a)
Rationale: The 'finally' block ensures that the code within it is
executed regardless of whether an exception is thrown or not,
typically used for cleanup activities like closing files or streams.
©2024/2025
Intermediate Programming
Comprehensive Finals Review (Qns & Ans)
2025
1. Which of the following best describes polymorphism in
object-oriented programming?
a) The ability of different classes to be viewed as instances of
the same class through inheritance.
b) Encapsulation of data and functions that manipulate the data.
c) The capacity of a single function name to be used for
different types of arguments.
©2024/2025
, d) A means of organizing code for better structure and
readability.
ANS: a)
Rationale: Polymorphism allows objects of different classes
to be treated as objects of a common superclass, particularly
through a shared interface.
2. What is the primary advantage of using recursion over
iteration in some programming scenarios?
a) Easier to implement and understand for all types of problems.
b) Generally more memory efficient than iteration.
c) Suits problems where the outcome is naturally expressed in
recursive calls more clearly.
d) Allows for more extensive error handling.
©2024/2025
, ANS: c)
Rationale: Recursion often provides a clearer and more direct
approach to problems that have overlapping subproblems or a
lattice structure, such as sorting algorithms like quicksort or
merge sort.
3. When implementing concurrency in programming, which
model is designed to handle many small subtasks collectively
within a single larger task?
a) Thread-based concurrency
b) Process-based concurrency
c) Asynchronous programming
d) Task-based concurrency
ANS: d)
©2024/2025
, Rationale: Task-based concurrency allows for splitting larger
processes into smaller tasks, which can be handled concurrently to
improve efficiency and manage resources better.
4. In context with exception handling in Java, the 'finally' block
is used to:
a) Close resources like files and connections that must be closed
regardless of exceptions.
b) Handle specific exceptions and provide alternative actions.
c) Catch the most specific exception that has occurred.
d) Modify the exception message before propagation.
ANS: a)
Rationale: The 'finally' block ensures that the code within it is
executed regardless of whether an exception is thrown or not,
typically used for cleanup activities like closing files or streams.
©2024/2025