Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

DATA STRUCTURES AND ALGORITHMS REVIEW. | FROM QUESTION TO PERFECTION| STUDY WITH CONFIDENCE!

Document preview thumbnail
Preview 2 out of 8 pages

DATA STRUCTURES AND ALGORITHMS REVIEW. | FROM QUESTION TO PERFECTION| STUDY WITH CONFIDENCE!

Content preview

DATA STRUCTURE AND ALGORITHMS | FROM QUESTION
TO PERFECTION| STUDY WITH CONFIDENCE!

Course Code:
Course Title:
Programme:
Academic Year: 2026/2027
Duration: 2 Hours.
Total Marks: 70%.


Candidate Instructions:
1) Write your Registration Number on every answer booklet used.
2) Answer ALL questions in Section A and ANY TWO (2) questions in Section B.
3) Read each question carefully before answering.
4) Begin each question on a new page.
5) The marks for each question are indicated in brackets.
6) This paper consists of several printed pages, including this page.
7) Ensure your copy is complete before the examination begins.
8) Unauthorized materials and communication with other candidates are not permitted.




Turn Over.




APPHIA – Crafted with Care and Precision for Academic Excellence.
1

, What is recursion? Answer: Recursion is the ability of a function to call itself.
What is the goal of the Towers of Hanoi problem? Answer: Move a tower of discs from Pillar 1
to Pillar 3.
What are the rules of the Towers of Hanoi? Answer: 1. A larger disc cannot be placed on top of
a smaller disc. 2. Only one disc can be moved at a time.
What is a recursive solution approach for moving n discs? Answer: 1. Move the top n-1 discs to
the temporary pillar. 2. Move the largest disc to the destination pillar. 3. Move the n-1 discs
from the temporary pillar to the destination.
Why use recursion? Answer: Recursion can provide cleaner, more intuitive solutions for
problems that are naturally self-similar.
What is a key challenge in recursion? Answer: The terminating condition must be defined to
prevent infinite loops.
What are the advantages of using recursion? Answer: 1. Simpler, cleaner code. 2. Mirrors
problem structure. 3. Reduces need for manual state tracking. 4. Easier for divide-and-conquer
problems.
What is a disadvantage of recursion? Answer: 1. High memory usage due to call stack. 2.
Performance overhead compared to iterative solutions. 3. Risk of infinite recursion. 4. Can be
hard to trace and debug.
What is Test Driven Development (TDD)? Answer: TDD is an evolutionary approach to
development that combines test-first development with refactoring.
What are the two simple rules of TDD? Answer: 1. Write new business code only when an
automated test has failed. 2. Eliminate any duplication found.
What is Test First Development (TFD)? Answer: TFD is the practice of writing tests before
writing any functional code.
What are the benefits of TDD? Answer: 1. Improves code quality. 2. Reduces bugs. 3. Provides
documentation. 4. Encourages simpler design. 5. Increases confidence.
What are common assertions in unit testing? Answer: General asserts include: Are Equal, Are
Not Equal, Is Null, Is Not Null, Is True, Is False.
What is Big-O notation? Answer: Big-O notation measures the efficiency and scalability of an
algorithm, estimating how runtime or space requirements grow relative to input size.
What does O(1) represent in Big-O notation? Answer: O(1) represents constant time
performance, where performance does not change with input size.
What does O(n) represent in Big-O notation? Answer: O(n) represents linear time performance,
where performance grows directly proportional to input size.


APPHIA – Crafted with Care and Precision for Academic Excellence.
2

Document information

Uploaded on
August 17, 2026
Number of pages
8
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$14.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Apphia
3.0
(2)
Sold
5
Followers
0
Items
3652
Last sold
2 weeks ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions