EECE7205_Exam1 Review Questions

.pdf

School

Northeastern University *

*We aren’t endorsed by this school

Course

7205

Subject

Electrical Engineering

Date

Apr 3, 2024

Type

pdf

Pages

4

Uploaded by BaronSummer2048

Report
Page 1 of 4 Northeastern University College of Engineering Department of Electrical & Computer Engineering EECE7205: Fundamentals of Computer Engineering First Midterm Exam Review Questions For questions Q1 to Q17 choose the best answer. Make a circle around your letter choice. Q1. In the shown INSERTION-SORT algorithm, to sort list A into a decreasing instead of an increasing order, the following change(s) is(are) needed: a. Step 4: i = j +1 b. Step 5: while i > 0 and A [ i ] < key c. Step 7: i = i + 1 d. All of the above. Q2. For the INSERTION-SORT algorithm in the previous question. Assume list A has ten elements and it is already sorted. How many actual lines of code will be executed? a. 45 b. 46 c. 70 d. 80 Q3. The linear search algorithm checks every element in a list sequentially until the desired element is found. If the algorithm is applied on a list of n elements, then its asymptotic worst and best running times are: a. Θ ( n 2 ) and Θ ( n ) b. Θ (2 n ) and Θ ( n ) c. Θ ( n ) and Θ (1) d. None of the above. Q4. Assume f ( n ) = 2 n and g ( n ) = 2 n /2 , then the following is true: a. f ( n ) = Θ ( g ( n )) b. f ( n ) = O ( g ( n )) c. f ( n ) = ( g ( n )) d. All of the above. Q5. What are the minimum and maximum numbers of elements in a heap of height h ? a. 2 h and 2 h +1 - 1 b. 2 h - 1 and 2 h +1 c. 2 h- 1 and 2 h - 1 d. None of the above. Q6. Is the heap represented by an array with values [23, 17, 14, 6, 13, 10, 1, 5, 7, 12] a max-heap? a. Yes b. No Q7. What are the leaves of the heap represented by an array with values: [23, 17, 14, 6, 13, 10, 1, 5, 7, 12]? a. [5, 7, 12] b. [7, 12] c. [1, 5, 7, 12] d. [10, 1, 5, 7, 12] Q8. A heap is represented by an array with values A = [27, 17, 3, 16, 13, 10, 1, 5, 7, 12, 4, 8, 9, 0]. The following will be the contents of A after applying the operation of MAX-HEAPIFY( A , 3) . a. [27, 17, 10, 16, 13, 9, 1, 5, 7, 12, 4, 8, 3, 0] b. [27, 17, 10, 16, 13, 3, 1, 5, 7, 12, 4, 8, 9, 0] c. [27, 17, 16, 3, 13, 10, 1, 5, 7, 12, 4, 8, 9, 0] d. None of the above
Page 2 of 4 Q9. What is the running time of the HEAPSORT algorithm on an array A of length n that is already sorted? a. Θ ( n ) b. Θ ( n lg n ) c. Θ (lg n ) d. None of the above. Q10. What is the running time of the HEAPSORT algorithm on an array A of length n that is initially in reverse sorted order? a. Θ ( n ) b. Θ ( n lg n ) c. Θ (lg n ) d. None of the above. Q11. Assume an initially empty stack S stored in array S [1 .. 6] and the top of the stack is initially S [1]. What will be the content of S after the following operations in the sequence PUSH(S,4), PUSH(S, 1), PUSH(S, 3), POP(S), PUSH(S, 8), and POP(S)? a. [4, 1, 3, 8] b. [8, 3, 1, 4] c. [4, 1] d. [3, 8] Q12. Assume an initially empty queue Q stored in array Q [1 .. 6] and both its head and tail are pointing to Q [1]. What will be the content of Q after the following operations in the sequence ENQUEUE(Q, 4), ENQUEUE(Q, 1), ENQUEUE(Q, 3), DEQUEUE(Q), ENQUEUE(Q, 8), and DEQUEUE(Q)? a. [4, 1, 3, 8] b. [8, 3, 1, 4] c. [4, 1] d. [3, 8] Q13. For hashing by the division method, which of the following is the best choice for the modulus m ? a. 256 b. 181 c. 128 d. 10 Q14. Given a hash table with size m = 13 and starting index 0 , and a hash function h ( k ) = k mod m . For k = 25 , state the hash position (home slot) and the following three positions if linear probing is used for collision resolution. a. 12, 13, 14, 15 b. 11, 12, 13, 14 c. 12, 0, 1, 2 d. 11, 12, 0, 1 Q15. Suppose that we have numbers between 1 and 1000 in a binary search tree, and we want to search for the number 363. Which of the following sequences could not be the sequence of nodes examined? a. 2, 252, 401, 398, 330, 344, 397, 363. b. 924, 220, 911, 244, 898, 258, 362, 363. c. 925, 202, 911, 240, 912, 245, 363. d. 2, 399, 387, 219, 266, 382, 381, 278, 363. e. 935, 278, 347, 621, 299, 392, 358, 363. Q16. What is the maximum number of keys that can be stored in a B-tree of height 2 and minimum degree 3? a. 24 b. 35 c. 124 d. 215 Q17. For a B-tree with a minimum degree 3, what is its possible maximum height to store 17 keys? a. 2 b. 3 c. 4 d. 5 End of multiple-choice questions
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help