Uploaded by Faisal Nisar

Final A

advertisement
1/5/23, 11:49 PM
Learning Management System : 2002 SSE Data Structures (CS 202 S1-Lecture) : Tests & Quizzes
Tests & Quizzes
CS202 Final Exam - Part A
Return to Assessment List
Part 1 of 7 - Part 1 2.0 / 14.0 Points
Question 1 of 7 2.0
14.0 Points
* Complexity and Data Structures
A. O(1)
B. O(logn)
C. O(n)
D. O(n^2)
E. O(n^3)
F. O(2^n)
G. O(e^n)
H. O(n!)
I.
O(n^n)
J.
O(nlogn)
Minimum estimated time for this question: 10mins
Maximum estimated time for this question: 14mins
You should plan to spend your time judiciously.
Pick the tightest bound for each problem. Loose bounds will NOT be accepted as valid answers.
For each of the items below, select the most appropriate answer option(s) above (e.g., A, G, I, J).
Each answer option may be used once, more than once, or not at all.
1
B
https://lmsarchive-2022.lums.edu.pk/portal/site/9c9cba76-96d6-4634-8f60-b2a158361649/tool/62fb7222-e8ce-4a8e-86d0-f9d954c1c7b5/jsf/select… 1/7
1/5/23, 11:49 PM
2
C
3
A
4
B
5
J
6
E
Learning Management System : 2002 SSE Data Structures (CS 202 S1-Lecture) : Tests & Quizzes
https://lmsarchive-2022.lums.edu.pk/portal/site/9c9cba76-96d6-4634-8f60-b2a158361649/tool/62fb7222-e8ce-4a8e-86d0-f9d954c1c7b5/jsf/select… 2/7
1/5/23, 11:49 PM
7
Learning Management System : 2002 SSE Data Structures (CS 202 S1-Lecture) : Tests & Quizzes
A
Answer Key: | 1: B | 2: A | 3: C | 4: C | 5: D | 6: J | 7: B |
Part 2 of 7 - Part 2 0.0 / 5.0 Points
Question 2 of 7 0.0
5.0 Points
Minimum estimated time for this question: 2mins
Maximum estimated time for this question: 3mins
Please plan to spend your time judiciously.
Consider the following code.
Zoha and Bilal are asked about the tightest worst-case running time complexity of thematrix(.), Bilal
says it is in O(log2 n) whereas Zoha says it is in O(n). Who is right?

A. Both are right

B. Only Zoha is right

C. Both are wrong

D. The question is ill-posed
https://lmsarchive-2022.lums.edu.pk/portal/site/9c9cba76-96d6-4634-8f60-b2a158361649/tool/62fb7222-e8ce-4a8e-86d0-f9d954c1c7b5/jsf/select… 3/7
1/5/23, 11:49 PM

Learning Management System : 2002 SSE Data Structures (CS 202 S1-Lecture) : Tests & Quizzes
E. Only Bilal is right
Answer Key: E
Part 3 of 7 - Part 3 0.0 / 5.0 Points
Question 3 of 7 0.0
5.0 Points
Click to see additional instructions
Minimum estimated time for this question: 3mins
Maximum estimated time for this question: 4mins
You should plan to spend your time judiciously.
Answer: 7
Answer Key: 8
Part 4 of 7 - Part 4 2.5 / 2.5 Points
Question 4 of 7 2.5
2.5 Points
Minimum estimated time for this question: 3mins
Maximum estimated time for this question: 4mins
You should plan to spend your time judiciously.
https://lmsarchive-2022.lums.edu.pk/portal/site/9c9cba76-96d6-4634-8f60-b2a158361649/tool/62fb7222-e8ce-4a8e-86d0-f9d954c1c7b5/jsf/select… 4/7
1/5/23, 11:49 PM

Learning Management System : 2002 SSE Data Structures (CS 202 S1-Lecture) : Tests & Quizzes
True
False
Answer Key: False
Part 5 of 7 - Part 5 2.5 / 2.5 Points
Question 5 of 7 2.5
2.5 Points
Minimum estimated time for this question: 3mins
Maximum estimated time for this question: 4mins
You should plan to spend your time judiciously.
You are constructing a new hash code for mapping strings to integers as shown below.
hashcode(s) = b0s0 + b1s1 + … + bksk
where b > 0 is an integer and si is the integer code for the ith character of the input string s. Suppose that
the input to the hash code is restricted to strings containing the following characters only: ‘a’, ‘b’, ‘t’, ‘o’, ‘p’.
The integer codes for these characters are as follows:
a=1; b=2; t=3; o=4; p=5
You are comparing the effectiveness of using two bases (b=2 and b=7) for reducing collisions between
hash codes. Your friend claims that using b=2 will lead to less collisions than b=7. Is this statement true?

True
False
Answer Key: False
Part 6 of 7 - Part 6 5.0 / 5.0 Points
https://lmsarchive-2022.lums.edu.pk/portal/site/9c9cba76-96d6-4634-8f60-b2a158361649/tool/62fb7222-e8ce-4a8e-86d0-f9d954c1c7b5/jsf/select… 5/7
1/5/23, 11:49 PM
Learning Management System : 2002 SSE Data Structures (CS 202 S1-Lecture) : Tests & Quizzes
Question 6 of 7 5.0
5.0 Points
Minimum estimated time for this question: 3mins
Maximum estimated time for this question: 4mins
You should plan to spend your time judiciously.
Which one of the following statements is always true for an AVL tree of n nodes?

A. A list of all keys in the AVL tree, in sorted order, can be produced in O(logn) time
B. Given any key value b, the smallest key in the AVL tree that is strictly larger than b can
be found in time O(log n).


C. The median key always appears in the root node

D. Rebalancing the AVL tree after a single insertion can be done in time O(1).

E. The key in any AVL tree node is at least as large as the keys in both of its children nodes.
Answer Key: B
Comment: This answer is also correct. Your marks have been updated.
Part 7 of 7 - Part 7 2.5 / 2.5 Points
Question 7 of 7 2.5
2.5 Points
Minimum estimated time for this question: 1mins
Maximum estimated time for this question: 2mins
You should plan to spend your time judiciously.
It is possible to construct more efficient encoding than given by Huffman encoding for text compression.

True
False
Answer Key: True
https://lmsarchive-2022.lums.edu.pk/portal/site/9c9cba76-96d6-4634-8f60-b2a158361649/tool/62fb7222-e8ce-4a8e-86d0-f9d954c1c7b5/jsf/select… 6/7
1/5/23, 11:49 PM
Learning Management System : 2002 SSE Data Structures (CS 202 S1-Lecture) : Tests & Quizzes
https://lmsarchive-2022.lums.edu.pk/portal/site/9c9cba76-96d6-4634-8f60-b2a158361649/tool/62fb7222-e8ce-4a8e-86d0-f9d954c1c7b5/jsf/select… 7/7
Download