0% found this document useful (0 votes)
797 views

COS30008 - 2021 Final Exam Questionnaire

This document is the cover sheet for the final exam in the subject COS30008 Data Structures & Patterns at Swinburne University of Technology. The exam is due on June 3, 2021 at 1:00 PM and is administered by Dr. Markus Lumpe. The exam consists of 5 problems worth a total of 342 marks and is estimated to take 120 minutes to complete. This exam accounts for 50% of the student's overall mark for the semester.

Uploaded by

Minhh Tu
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)
797 views

COS30008 - 2021 Final Exam Questionnaire

This document is the cover sheet for the final exam in the subject COS30008 Data Structures & Patterns at Swinburne University of Technology. The exam is due on June 3, 2021 at 1:00 PM and is administered by Dr. Markus Lumpe. The exam consists of 5 problems worth a total of 342 marks and is estimated to take 120 minutes to complete. This exam accounts for 50% of the student's overall mark for the semester.

Uploaded by

Minhh Tu
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/ 3

COS30008 Semester 1, 2021 Dr.

Markus Lumpe

Swinburne University of Technology

Faculty of Science, Engineering and Technology

FINAL EXAM COVER SHEET

Subject Code: COS30008


Subject Title: Data Structures & Patterns
Due date: June 3, 2021, 13:00
Lecturer: Dr. Markus Lumpe

Your name: Nguyen Minh Tu Your student id: 103441055

Wed Wed Wed Thurs Thurs Thurs Thurs Fri Fri Fri
Check
08:30 10:30 16:30 08:30 10:30 14:30 16:30 08:30 10:30 14:30
Tutorial

Marker's comments:

Time Estimate
Problem Marks Obtained
in minutes

1 50 20

2 54 15

3 42 10

4 60 15

5 8+128=136 60

Total 342 120

This test requires approx. 2 hours and accounts for 50% of your overall mark.

Final Online Exam, Semester 1 2021 Page 1 of 11


COS30008 Semester 1, 2021 Dr. Markus Lumpe

Problem 1 (50 marks)


Answer the following questions in one or two sentences:
a. How can we construct a tree where all subtrees have the same degree? (4 marks)

This sort of tree may be formed by following the set of rules outlined below:
(i)For i>=0, the maximum number of nodes at level I is 2^i.
(ii) The greatest number of all nodes in a tree of height h is 2^(h+1)-1, while the
1a) minimum number is 1.
Following the application of these criteria, we design a tree in which all subtrees
have the same degree.

b. What are reference data members and how do we initialize them? (2 marks)

To refer to items that are outside of this class's domain. The constructor initializer
list can be used to initialize them.

1b)

c. What is the difference between l-value and r-value references? (6 marks)

Temporary values are what r-values are.(ie. 9, "word".)


l-values are addresses in memory or a variable that represent values (ie. int a,
float b, etc.)
1c)

d. What is an object adapter? (6 marks)

Depending on the class's composition, an object adapter covers both the class
and its interface. The object source is included in order to expand the interface of
the original source.
1d)

e. What is a key concept of an abstract data types? (4 marks)

The data type's visual representation is known as the user interface. Provides the
ability to alter the data type through the implementation.

1e)

Final Online Exam, Semester 1 2021 Page 2 of 11


COS30008 Semester 1, 2021 Dr. Markus Lumpe

f. How do we define mutual dependent classes in C++? (4 marks)

It may be done by utilizing the class's forward declaration. The idea of advance
declaration of class might be used.

1f)

g. What must a value-based data type define in C++? (2 marks)

- Stack-allocated variables. - Possesses an assignment operator that copies


other variables to itself. There is no correlation between changes in one variable
and changes in the value of another. Copy constructors are available, allowing for
1g) the creation of duplicates of other variables.

h. What is the difference between copy constructor and assignment operator and how do
we guarantee safe operation? (8 marks)

- Stack-allocated variables.
- Possesses an assignment operator that copies other variables to itself.
-There is no correlation between changes in one variable and changes in the
1h) value of another.
-Copy constructors are available, allowing for the creation of duplicates of other
variables.

i. What is the best-case, average-case, and worse-case for a lookup in a binary tree?
(6 marks)

- best-case is O(1)
- average-case is O(logn)
- worse-case is O(n)
1i)

j. You are given a set of n-1 numbers out of n numbers. How do we find the missing
number nk, 1 ≤ k ≤ n, in linear time? (8 marks)

We have: Sum1 = n(n+1)/2


We have Sum2 = sum of n-1 elements
Missing element = sum1- sum2 = n(n+1)/2 - sum of n-1 elements
1j)

Final Online Exam, Semester 1 2021 Page 3 of 11

You might also like