CS-301 Final Term Exams Preparation Virtual University With Answers

image
image
image

CS-301 Final Term Exams Preparation Virtual University

Sr. # Questions Answers Choice
1 Suppose that a selection sort of 100 items has completed 42 iterations of the main loop. How many items are now guaranteed to be in their final spot (never to be moved again)? 21 41 42 53
2 Consider a min heap, represented by the following array: 10,30,20,70,40,50,80,60 After inserting a node with value 31.Which of the following is the updated min heap? 10,30,20,31,40,50,80,60,70 10,30,20,70,40,50,80,60,31 10,31,20,30,40,50,80,60,31 31,10,30,20,70,40,50,80,60
3 Which of the following statement is true about dummy node of threaded binary tree The left pointer of dummy node points to the itself while the right pointer points to the root of tree. The left pointer of dummy node points to the root node of the tree while the right pointer points itself i.e. to dummy node The left pointer of dummy node points to the root node of the tree while the right pointer is always NULL The right pointer of dummy node points to the itself while the left pointer is always NULL
4 Huffman encoding uses _________ tree to develop codes of varying lengths for the letters used in the original message Linked List Stack Queue Binary tree
5 Merge sort and quicksort both fail into the same category of sorting algorithms,What is this category ? O(nlogn) sorts Interchange sort Average time is quadratic None of the given options.
6 A simple sorting algorithm like selection sort or bubble sort have a wrostcase of O(1) time because all lists take the same amount of time to sort O(n) time because it has to perform n swaps to order the list. O(n<sup>2</sup> ) time because sorting 1 element takes O(n) time - After 1 pass through the list, either of these algorithms can guarantee that 1 element is sorted. O(n<sup>3</sup> ) time, because the worst case has really random input which takes longer to sort.
7 Binary Search is an algorithm of searching ,used with the ____ data . Sorted Unsorted Heterogeneous Heterogeneous
8 Union is a ___________ time operation Constant Polynomial Exponential None of the above
9 Which of the following is not an example of equivalence relation: Electrical Connectivity Set of people &lt;= relation Set of pixels
10 The definition of Transitivity property is For all element x member of S, x R x For all elements x and y, x R y if and only if y R x For all elements x, y and z, if x R y and y R z then x R z For all elements w, x, y and z, if x R y and w R z then x R z
Download This Set