Exam Date: Saturday 20/5/2023 Â Â Allowed Time: 2 hours
Dr. Salwa Osama
1 point
1
Question 1
1.
What is a hash table?
1 point
1
Question 2
2.
If several elements are competing for the same bucket in the hash table, what is it called?
1 point
1
Question 3
3.
What is the hash function used in the division method?
1 point
1
Question 4
4.
What can be the value of m in the division method?
1 point
1
Question 5
5.
Using division method, in a given hash table of size 157, the key of value 172 is placed at position
1 point
1
Question 6
6.
What is the table size when the value of p is 7 in multiplication method of creating hash functions?
1 point
1
Question 7
7.
What is the average retrieval time when k has the same slot?
1 point
1
Question 8
8.
Collisions can be reduced by choosing a hash function randomly in a way that is independent of the keys that are actually to be stored.
1 point
1
Question 9
9.
What is indirect addressing?
1 point
1
Question 10
10.
What is the search complexity in direct addressing?
1 point
1
Question 11
11.
What is a hash function?
1 point
1
Question 12
12.
Which of the following is not a technique to avoid a collision?
1 point
1
Question 13
13.
What is the load factor?
1 point
1
Question 14
14.
What is simple uniform hashing?
1 point
1
Question 15
15.
In simple chaining, what data structure is appropriate?
1 point
1
Question 16
16.
A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below.
0:
1: 42
2:
3:
4: 23
5: 52
6:
7: 33
8: 34
9:
Which one of the following choices gives a possible order in which the key values could have been inserted in the table?
1 point
1
Question 17
17.
Maximum number of nodes in a binary tree with height k, where root is height 0, is
1 point
1
Question 18
18.
Quick sort algorithm is an example of
1 point
1
Question 19
19.
The minimum number of edges required to create a cyclic graph of n vertices is
1 point
1
Question 20
20.
Which of the following is example of not in-place algorithm?
1 point
1
Question 21
21.
Time required to sort "n" identical items of size m and n, is
1 point
1
Question 22
22.
Which of the following uses memorization?
1 point
1
Question 23
23.
Heap is an example of
1 point
1
Question 24
24.
Access time of a binary search tree may go worse in terms of time complexity up to
1 point
1
Question 25
25.
What will be the Huffman code for the letters a,b,c,d,e? If the probability are ½,1/4, 1/8,1/16,1/32
1 point
1
Question 26
26.
From the following sorting algorithms which algorithm needs the minimum number of swaps
1 point
1
Question 27
27.
From the following sorting algorithms which has the lowest worst case complexity?
1 point
1
Question 28
28.
Match the following pairs
I. O(\log\ n) Â Â (M) Heap sort
II. O(n) Â Â (N) DFS
III. n\log(n) Â Â (O) Binary search
IV. O(n^2) Â Â (P) Selecting kth smallest elements
1 point
1
Question 29
29.
What shall be value of x in the following pseudocode?
x = 0; For (t = t; t <= N; t++) For p = l; p <= t; p++)
x = x+1; EndFor EndFor
1 point
1
Question 30
30.
Time complexity on merging three sorted lists of sizes m, n and p is
1 point
1
Question 31
31.
Which of the algorithm design approach is used by Mergesort
1 point
1
Question 32
32.
Which of the following shortest path algorithm cannot detect presence of negative weight cycle graph?
1 point
1
Question 33
33.
For the figure below, starting at vertex A, which is a correct order for Prim's minimum spanning tree algorithm to add edges to the minimum spanning tree?
1 point
1
Question 34
34.
Graph Algorithms Questions
For the figure below, which is a correct order for Kruskal's minimum spanning tree algorithm to add edges to the minimum spanning tree?
∑ ∧ | B
1 point
1
Question 35
35.
If G is an directed graph with 20 vertices, how many boolean values will be needed to represent G using an adjacency matrix?
1 point
1
Question 36
36.
What is the special property of red-black trees and what root should always be?
1 point
1
Question 37
37.
Why do we impose restrictions like . root property is black . every leaf is black . children of red node are black . all leaves have same black
1 point
1
Question 38
38.
What are the operations that could be performed in O(logn) time complexity by red-black tree?
1 point
1
Question 39
39.
Why Red-black trees are preferred over hash tables though hash tables have constant time complexity?
1 point
1
Question 40
40.
Pseudo Code
What is the below pseudo code trying to do, where pt is a node pointer an l root pointer?