Answer Key
University
California State UniversityCourse
COMP 182 | Data Structures and Program Design and LabPages
1
Academic year
2023
anon
Views
94
COMP 182-16324-FA2022 > Quizzes > Final Exam Final Exam Due Dec 17, 2022 at 12pm Points 60 Questions 60 Available Dec 17, 2022 at 8am - Dec 17, 2022 at 12pm 4 hours Time Limit 120 Minutes This quiz is no longer available as the course has been concluded. Attempt History Attempt Time Score LATEST Attempt 1 80 minutes 57 out of 60 ! Correct answers are no longer available. Score for this quiz: 57 out of 60 Submitted Dec 17, 2022 at 10:48am This attempt took 80 minutes. Question 1 1/1 1 pts Identify the depth of node Q. A X Y P 2 3 0 1
Question 2 1 1 pts Given the list (11, 22. 25). which is the correct way to add 32 to the list in ascending order? InsertAfter(list, 32) InsertAfter(list, 25, 32) Prepend(list, 32. 25) Prepend(list, 32) Question 3 1/1 pts Identify the valid set that can be constructed from a collection of numbers 10, 11, 20, 22, 33, 39. 43. 11. 20. (10. 11, 20, 22, 33, 39. 43] [10. 11. 20. 22. 33. 39. 47] [10. 11. 20. 22. 33. 39. 43. 11. 20) [12. 23. 34. 48] Question 4 1/1 pts Identify the shortest path between vertices B and D. x2 B C x1 x6 A x3 x7 x5 D E x4 x6. x3, x7 x7, x4 x1, x5 x2. x3. x4
Question 5 1/1 pts Which is an abstract data type (ADT)? A string A boolean A float A list Question 6 1/1 pts Given the list (20, -35, 50, -52, 65, -53), what is the list after sorting by the 1's digit? (20, 50, -52, -53, 65, -35) (20, 50, -52, -53, -35,65) (-35, -53, -52, 50, 20, 65) (-35, -52, -53, 20, 50, 65)
Question 7 1/1 pts Identify the adjacency matrix for the graph. B C A D E ABCDE A01110 B10001 C10010 D10100 E1000 ABCDE A00010 B00101 C :01001 D 010001 E 0110 ABCDE A01110 B10001 C10011 D10101 E1110 ABCDE A01110 B10101 C11010 D10100 E01000
Question 8 1/1 pts Identify the vertices adjacent to C. B C A D E C B,D, and E A,B, and E B and E Question 9 1/1 pts A greedy algorithm is attempting to minimize costs and has a choice among five items with equivalent functionality but with different costs: $6, $5, $7, $8, and $2. Which item cost will be chosen? O $2 $5 $8 $6
Question 10 1/1 1 pts The red-black tree below remains valid if the color of nodes are changed. A X Y P Q C D F G R S Y.C. and D A, X, and Y P. F, and G X.P. and Q Question 11 0/: 1 pts Given the list (xlsx, xls, xlr, txt, ods), what is the order of the elements after completing insertion sort's second outer loop iteration? txt. xlr, xls, xlsx, ods xls. xlsx, xlr. txt. ods o ods, txt. xlr, xls, xlsx xlr, xls, xlsx, txt, ods
Question 12 1 / 1 pts A grocery bag can carry a maximum weight of 5 pounds. A heuristic technique repeatedly selects the most expensive item that will still fit in the bag, in an attempt to maximize the bag's value. The heuristic fills the grocery bag with . Apples Pineapples Melons Oranges 2 pounds 3 pounds 4 pounds 1 pound $10 $8 $ 12 $7 4 pounds apples and 1 pound oranges, which is not optimal 4 pounds apples and 1 pound oranges, which is optimal 4 pounds melons and 1 pound oranges, which is not optimal 4 pounds melons and 1 pound oranges, which is optimal
Question 13 1/1 pts Identify the correct rotation to maintain the height balance of the AVL tree. 6 4 7 3 8 2 6 3 7 2 4 8 4 3 6 2 7 8 4 3 6 2 7 8 4 3 6 2 7 8
Question 14 1/1 pts In a singly-linked list with 1 element, the tail pointer and the next pointer of the head node . points to the last node, points to the first node is null, is null is null, points to the head node e points to the head node, is null Question 15 1/1 pts Which is the last vertex in a valid topological sort? B C A D E D C C E A
Question 16 1/1 pts Identify the AVL tree. 6 8 3 6 8 6 5 3 6 4 8 3 9 Question 17 1/ pts If search key - 9. identify the sequence of nodes that are visited and the outcome 10 11 9 10 18 2 4 9 10 - 11 .. 9 10 3-+ 10 11 8 9 10 9
Question 18 1/1 pts Identify the statement that is true of linked list traversal. A list traversal algorithm starts with the list's next node. A doubly-linked list does not support list traversal A doubly linked list's reverse traversal starts with the list's tail node. A singly-linked list supports reverse traversal Question 19 1/1 pts Identify the correct way of denoting the union of sets A and B. Av B AnB A\B A B Question 20 1/1 pts Identify the type of the following binary tree. x F G R S Not full. complete. not perfect Full, complete. perfect Full, not complete. not perfect Full. complete. not perfect
Question 21 1/1 pts Which of the following best represents a sparse graph? B E A C D B C A D E B E A D G C F B E A C D Question 22 1/1 pts Set A = {12, 24, 26, 38, 42] and Set B = {10, 20, 26, 30, 42). Identify A n B. 12, 24, 38 10. 12. 20. 24. 30. 38 10, 12. 20, 24, 26. 30, 38, 42 o 26.42
Question 23 1/ 1 pts Identify the acyclic graph. B C A D E B C A D E B C A D E B C A D E Question 24 1/ 1 pts What is the height of a BST built by inserting nodes in the order 12, 24, 23, 48, 47? 1 3 2 4
Question 25 1/1 pts Which of the following rules does a valid BST follow? Right subtree keys left subtree keys Left subtree keys node's keys Left subtree keys node's keys Right subtree keys < node's keys Question 26 1/1 pts What type of node is "English"? Students Tom Mark English Math Science English Practical.jpg Theory.doc Parent Leaf Internal node Root
Question 27 1/1 pts Identify the adjacency matrix for the graph. B E A C D ABCDE A11100 B10001 C10010 D 100100 E01000 ABCDE A10010 B00100 C01001 D 110001 E00110 ABCDE A00010 B00100 C01001 D 110001 E00110 ABCDE A01100 B 110001 O C 110010 D 000100 E 001000
Question 28 1/1 pts What is the merge sort algorithm's runtime? O(N2) O(logN) O(N-logN) O(N) Question 29 1/1 pts Identify the breadth-first search traversal from vertex C. B C A D E CDEBA C01123 C B E A D O C01122 CBEDA C01123 C D E B A C01144
Question 30 1/1 pts Identify the correct sequence of operations after inserting 35 in the tree. 70 51 90 45 60 82 95 40 Step 1. Insert 35 as node 40's left child Step 2. Color the parent, node 40, black Step 3. Color the grandparent, node 45. red Step 4. Rotate right at node 45 Step 1. Insert 35 as node 40's left child Step 2. Rotate right at node 45 Step 3. Rotate left at node 40 Step 4. Color the parent, node 40, black Step 1. Insert 35 as node 40's left child Step 2. Rotate left at node 40 Step 3. Color the grandparent, node 45, red Step 4. Rotate right at node 45 Step 1. Insert 35 as node 40's left child Step 2. Rotate right at node 40 Step 3. Color the parent, node 40, black Step 4. Color the child, node 45, red
Question 31 1/ 1 pts Which of the following is not a valid set? (10.15.20) [12. 14. 16] {11. 22. 33, 11] (5. 10. 15) Question 32 1/ 1 pts In the following graph, which city is not directly connected to City 1? City 2 City 3 City 1 City 4 City 7 City 5 City 6 City 2 City 5 City 6 City 7 Question 33 1/ pts Which cities are connected to City 6 directly? City 2 City 3 City 1 City 4 City 7 City 5 City 6 City 4. City 7. and City 1 City 4. City 7. and City 2 City 4. City 3. and City 2 City 5. City 7. and City 1
Question 34 1/ 1 pts A move-to-front self-adjusting heuristic algorithm was applied to the given list when searching for 67 and then 72. What is the list after the search operations? 45 89 54 34 22 72 67 22344554677289 67 72 54 34 22 45 89 72674589543422 Incorrect Question 35 0/1 pts In a tree representing a file system, . leaf nodes represent only empty directories leaf nodes represent either files or empty directories leaf nodes represent only non-empty directories leaf nodes represent only files Question 36 1/ 1 pts What is the total edge weight sum of the graph? J I 6 5 5 F B 2 A 4 D 11 44 12 . 22
Question 37 1/1 pts If a queue is implemented as a linked list, a dequeue removes node. the head a random the middle the tail Question 38 1/1 pts What happens when a leaf node is removed? The internal node becomes null The root node becomes null The parent's left or right child node becomes null The parent node becomes null
Question 39 1/1 pts What is the tree when node 300 is removed? 200 100 300 50 150 250 350 325 375 . 200 100 325 50 150 250 350 375 200 100 375 50 150 250 350 325 200 100 325 50 150 250 350 200 100 375 50 150 250 350
Question 40 1/1 pts How many edges are there in the graph? O 7 5 10 8
Question 41 1/1 pts Identify the correct rotation to balance the red-black tree. 51 45 70 60 90 82 95 70 51 90 45 60 82 95 70 51 90 45 60 82 95 70 60 95 45 51 82 90 70 51 90 45 60 82 95
Question 42 1/1 pts In selection sort, the smallest element is selected and swapped with the unsorted element. leftmost middle next rightmost Question 43 1/1 1 pts Dynamic programming . stores solutions to subproblems in memory often involves recursive calls to functions often involves nested iterations accepts an incorrect solution in order to boost execution speed Question 44 1/1 pts Consider a hash table, a hash function of key % 10. Which of the following programmer-defined constants for quadratic probing cannot be used in a quadratic probing equation? c1 = 5 and c2 = 1 c1 = 1 and c2 = 0 c1 = 1 and c2= 5 c1 = 10 and c2 = 10
Question 45 1/1 pts Which of the following lists is sorted? apple, orange banana, pear 1.01. 1.02. 1.1. 1.001 Ted. Tom. Thomas Tim 89, 79, 63, 22 Question 46 1/ 1 pts How many vertices are there in the graph? 11 7 12 6 Question 47 1/1 pts As per Dijkstra's shortest path algorithm, which vertex is visited after starting from B? 4 B C 5 2 A 2 2 D E 3 C A E D
Question 48 1 / 1 pts Given a stack myData: 34, 56, 78, 12, 66 (top is 34) what is the output after the following operations? Push(myData 43) Pop(myData) Pop(myData) print(Peek(myData)) Pop(myData) print(Peek(myData)) 56 78 34 56 43 34 12 66 Question 49 1/1 pts What will the decrypted word be if the encrypted word is "ezs" after the Caeser cipher with a left shift of 1 is applied? eat fat bat cat
Question 50 1/ 1 pts Which is the character frequency table for the string ABRACADABRA? A1 B2 C2 D5 R1 A0 B1 C4 D6 R2 A0 B3 C4 D4 R3 A5 B2 C1 D1 R2 Question 51 1 / 1 pts Identify the number of elements in a set formed by adding the following: element 10, 4 times element 15, 5 times element 20, 6 times 3 15 16 2
Question 52 1/ 1 pts Which of the below sets are equivalent? {12, 10, 25) and {10, 25, 12} {10, 15. 20} and {15. 20. 25} {10, 12, 15} and {12, 15, 20) {20, 30, 25} and {20, 30, 35} Question 53 1 / 1 pts Set X = {34, 45, 56, 67, 78]. Function F = number +5. Identify the output of the function SetMap(X, F). 39, 50, 61, 72. 83 35, 45. 55. 65. 75 29, 40, 51, 62, 73 30, 40, 50, 60. 70 Question 54 1/1 pts Identify the correct statement about dynamic sets. You cannot perform filter operation on a dynamic set. You cannot remove an element from a dynamic set. You cannot add an element to a dynamic set. You can count the number of elements of a dynamic set.
Question 55 1/ 1 pts The weights indicate the frequency of buses between two stops. Most buses from stop B go to stop . 4 B C 5 A 7 2 2 D E 3 A D E Question 56 0/1 pts Which abstract data type (ADT) is most suitable to store a list of perishable products such that the product with the nearest expiry date is removed first? A priority queue A linked list A deque A queue
Question 57 1/ 1 pts A DFS traversal starting from vertex C will visit last. B C A D E either vertexA. vertex B. or vertex E vertex A vertex C either vertex A or vertex D Question 58 1/1 pts The head of the circular linked list is also called the node. tail start first circular Question 59 1 / 1 pts What is the shortest time taken to travel between A and G? E 8 Bmill 10min 6 min 11 min A D G 3 min C F 5 min 14 min 16 min 17 min 15 min
Question 60 1/1 pts What operation is used to compute a bucket index in the range 0 to 16 from a key? key - 17 key % 17 key / 17 key * 17 Quiz Score: 57 out of 60
COMP 182 Final Exam Quizzes
Please or to post comments