0% found this document useful (0 votes)
15 views7 pages

July 2023 2nd Paper

This document is an examination paper for the Bachelor of Computer Science qualification at Namibia University of Science and Technology, focusing on Data Structures and Algorithms 2. It includes multiple choice questions, true/false questions, and structured questions covering various topics such as binary search trees, AVL trees, and Huffman coding. The exam is scheduled for July 2023, lasts 3 hours, and is worth 90 marks.

Uploaded by

kmaryshane1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views7 pages

July 2023 2nd Paper

This document is an examination paper for the Bachelor of Computer Science qualification at Namibia University of Science and Technology, focusing on Data Structures and Algorithms 2. It includes multiple choice questions, true/false questions, and structured questions covering various topics such as binary search trees, AVL trees, and Huffman coding. The exam is scheduled for July 2023, lasts 3 hours, and is worth 90 marks.

Uploaded by

kmaryshane1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

nAmlBIA un1VERSITY

OF SCIEn CE Ano TECH n OLOGY

FACULTY OF COMPUTING AND INFORMATICS


DEPARTMENT OF SOFTWARE ENGINEERING

QUALIFICATION: BACHELOR OF COMPUTER SCIENCE

QUALIFICATION CODE: 07BCMS LEVEL: 7

COURSE: DATA STRUCTURESAND ALGORITHMS 2 COURSE CODE: DSA711S

DATE: JULY 2023 PAPER: THEORY

DURATION: 3 HOURS MARKS: 90

SECOND OPPORTUNITY/ SUPPLEMENTARY EXAMINATION QUESTION PAPER

Mr S. TJIRASO
EXAMINER(S)

MODERATOR: MRS P. DOLIAN

INSTRUCTIONS
1. Answer ALL the questions.
2. Read all the questions carefully before answering.
3. Number the answers clearly

THIS QUESTION PAPER CONSISTS OF 7 PAGES


{Including this front page)

PERMISSIBLE MATERIALS
1. NON-PRGRAMMABLE CALCULATOR
SECTION A: Multiple Choice Questions [20 Marks]
• Answer all the questions in the provided booklet.
• The section consists of 10 questions.

Problem Al
Study the Binary Search Tree below.

What is the height of node 96? [2 Marks]


A. 7
B. 82
C. 0
D. 2

Problem A2
Given an AVL tree of size n, what would be the maximum number of steps required to find a
node k placed anywhere in the tree? [2 Marks]
E. O(e")
A. O(n)
B. O(log(n))
C. 0(1)

Problem A3
Given the BST below, what will be the value of height as returned by the function max? [2
marks]

20

1
height=max(height,, height,)+ 1

A. 1
B. 2
C. 0
D. None of the above

Problem A4
What is the depth of node 34 in the tree in Problem A3 above? (2 Marks]
A. 0
B. 1
C. 2
D. None of the above

Problem AS
What is the height of node 60 in the tree in Problem A3 above? (2 Marks]
A. 0
B. 1
C. 2
D. None of the above

Problem AG
A binary search tree is constructed by inserting the following elements in order:
60,25, 72, 15, 30, 68, 100, 13, 18 ,47, 70. How many number of left subtree nodes? (2 Marks]

A. 5
B. 7
C. 3
D. 6
Problem A7
A hash function h defined h(key)=key mod 7, with linear probing, is used to insert the keys 45,
46, 80, 56, 92, 19, 65 into a table indexed from Oto 6. What will be the location of key 19? (2
Marks]
A. 3
B. 6
C. 5
D. 4

Problem AB
Linear Probing is a conflict resolution technique in __ ? (2 Marks]

A. Hashing

B. Searching

C. Queue
D. Sorting

2
Problem A9
Which of the following statement is correct with respect to pushing data onto stack data
structure? [2 Marks)

A. Push(int data)

B. Push()

C. Pop(int data)
D. None of the above

Problem AlO
Which one of the following techniques is not used in the Binary tree? [2 Marks)

A. lnorder traversal

B. Postorder traversal

C. Randomized traversal

D. Preorder traversal

3
SECTION B: True and False Questions [10 Marks]

• Answer all the questions in the provided booklet.


• The section consists of 5 questions.

Problem Bl
A recursive function without a base case is equivalent to an infinite loop. [2 Marks]

Problem B2
The head of a singly-linked always points to the last node. [2 Marks]

Problem B3
Given the following recursive function;

The line below is the correct base and recurisve case(s) for the function. [2 Marks]

Line: Base case is n == total and the recursive case total == n

Problem B4
Hashing is aimed at achieving searches, deletions and insertions in O(n). [2 Marks]

Problem BS
Two distinct keys hashing to the same index is known as coalition. [2 Marks]

4
SECTION C: Structured questions [60 Marks]
• Answer all the questions in the provided booklet.
• The section consists of 5 questions.

Problem Cl

Study the Binary Search Tree below

34

60

Write down all its BSTtraversals output below:


i. Preorder traversal [2 Marks]

ii. lnorder traversal [2 Marks]

iii. Postorder traversal [2 Marks]

iv. What is the depth of 60? [2 Marks]

Problem C2

Explain the difference between recursion and iteration as problem-solving approaches? [4 marks]

Problem C3
Construct a BSTfor the elements: 9, 8, 12, 16, 10, using post order traversal. [10 marks]

Problem C4

Name and briefly explain any three types of AVL tree rotations [6 marks]

Problem CS

Huffman Coding is a technique of compressing data to reduce its size without losing any of the details.
Some of the benefits of compressing data are that it can be transmitted faster over the network and can
reduce "data" costs for mobile subscribers for example. Huffman Coding is one of many examples of
binary tree applications.

5
Suppose the following string is to be sent over a network
IM IM 1
5 IE 1
5 1
5 IK I

Task:
a) What is the total size of the string as it is (in bits)? [2 marks]

b) What is the average code length (ACL) of the compressed code? [4 marks]

c) Apply Huffman Coding on the string and determine the Huffman tree, the code and code length of
each character. [22 marks]

d) What is the size of the encoded string? [4 marks]

* ** ******** ****** ** ********* End of Exam***********************************

You might also like