CS301 QUIZ-1 (lectures from 23 to 32)
JUNAID MALIK
GURANTE MARKS:
CONTACT ON:
0304-1659294
For More Visit:
https://vulmshelp.com/
AL-JUNAID INSTITUTE GROUP
1) If there are 100 elements in a heap and 100 delete Min operation are performed, will get
_____list
a. Sorted
b. Unsorted
c. Nonlinear
d. Noe
2) Sorting procedure normally takes ____times
a) NLogN
b) 2N
c) N*N*N
d) N
3) The expression if(!heap-> is empty ())
Checks
a) Heap is empty
b) Heap is full
c) Heap is not empty
4) If the height of a perfect binary tree is 4.What will be the total number of nodes in it?
a) 15
b) 16
c) 31
d) 32
5) A binary relation R over S is called an equivalence relation if it has following property(S)?
a) Reflexivity
b) Symmetry
c) Transitivity
d) All of the given
6) If a tree has 20 edges/links, then the total number of nodes in the tree will be:
a) 19
b) 20
c) 21
d) Cannot be determined
7) For a perfect binary tree of height 4, what will be the sum of highest of node
a) 31
b) 30
c) 27
d) 26
8) If Ahmed is cousin of Ali and Ali is cousin of Asad then Ahmed is also cousin of Asad.
This statement has the following property
a) Reflexivity
b) Symmetry
c) Transitivity
d) All of the above
9) Which property of equivalence relation is satisfied if we say:
Ahmad is cousin of Ali and Ali is also cousin of Ahmed
a) Reflexivity
b) Symmetry
AL-JUNAID INSTITUTE GROUP
c) Transitivity
d) All of the given
10) Which one of the following is NOT the property of equivalence relation?
a) Reflexive
b) Symmetric
c) Transitive
d) Associative
11) The main reason of using heap in priority queue is
a) Improve performance
b) Code readable
c) Less code
d) Heap can’t be used in priority queues
12) The total number of nodes on 10th level of perfect binary tree are
a) 256
b) 512
c) 1024
d) Can’t be determined
13) Suppose there are 100 elements in an equivalence class, so initially there will be 100 trees,
the collection of these trees is called ___________.
a) Cluster
b) Class
c) Forest
d) Bunch
14) The percolate Down procedure will move the smaller value ____ and bigger value ____.
a) Left, right
b) Right, left
c) Down, up
d) Up, down
15) For a perfect binary tree of height h, having N nodes, the Sum of height of nodes is _____
a) N - h -1
b) N - 1
c) N - 1 + h
d) N - (h - 1)
16) Which of the following method is helpful in creating the heap at once?
AL-JUNAID INSTITUTE GROUP
a. Insert
b. Add
c. Update
d. percolateDown
10. If ahmad is boss of Ahsan and ehsan is boss of umer then ahmad is also boss of umer,
the above mentioned relation is _______.
a. Reflexive
b. Symmetry
c. Transitive
d. None of given
11. If we want to find 3rd minimum element from an array of element, then after applying
build heap method. How many times deleteMin method will be called?
a. 1
b. 2
c. 3
d. 4
12. If we want to find median of 50 elements, then after applying builtHeap method, how
many time deleteMin method will be called?
a. 5
b. 25
c. 35
d. 50
13. Which of the following properties are satisfied by equivalence relationship?
a. Reflexive, symmetric
b. Reflexive, transitive
c. Symmetric, transitive
d. Reflexive, symmetric and transitive
14. Sorting procedure normally takes ________ time.
a. NlogN
b. 2N
c. N*N*N
d. N
15. The Expression
if ( ! heap->isFull()
) Check
a. Heap is empty
b. Heap is full
c. Heap is not empty
d. Heap is not full
16. The Expression
if ( ! heap->isEmpty() )
Check
a. Heap is empty
b. Heap is full
c. Heap is not empty
d. Not a valid expression
AL-JUNAID INSTITUTE GROUP
17. Given the values are the array representation of heap:
12 23 26 31 34 44 56 64 78 100
If we perform 4 deleteMin operation, the last element deleted is _______.
a. 31
b. 34
c. 44
d. 56
18. Which of the following heap method increase the value if key at position ‘p’ by the amount
‘delta’?
a. increaseKey(p, delta)
b. decreaseKey(p, delta)
c. percolateDown(p, delta)
d. remove(p, delta)
19. Which of the following heap method lowers the value if key at position ‘p’ by the
amount ‘delta’?
a. increaseKey(p, delta)
b. decreaseKey(p, delta)
c. percolateDown(p, delta)
d. remove(p, delta)
20. Which property of equivalence relation is satisfied if we
say: Ahmad R(is related to)Ahmad
a. Reflexivity
b. Symmetry
c. Transitivity
d. All of Above
21. The total number of nodes on 5th level of perfect binary tree are:
a. 16
b. 15
c. 31
d. 32
22. Which property of equivalence relation is satisfied if we say:
Ahmad is cousin of Ali and Ali is also Cousin of Ahmad
a. Reflexivity
b. Symmetry
c. Transitivity
d. All of the Above
23. If a tree has 50 nodes , then the total edges/links in the tree will be
a. 55
b. 51
c. 50
d. 49
24. If the height of perfect binary tree is 4, what will be the total number of nodes in it?
a. 15
b. 16
c. 31
d. 32
AL-JUNAID INSTITUTE GROUP
25. Suppose there are set of fruits and the set of vegetables, both sets are _______ sets.
a. Disjoint
b. Subset
c. Whole
d. Equal
26. A binary relation R over S is called an equivalence relation if it has following property(s)
a. Reflexivity
b. Symmetry
c. Transitivity
d. All of Above
27. Heap can be used to implement
a. Stack
b. Linked list
c. Queue
d. Priority queue
28. If a tree has 20 edges/links, then the total number of nodes in the tree will be:
a. 19
b. 20
c. 21
d. Can’t be determined
29. If there are 100 elements in heap, and 100 deleteMin operation are performed, will
get______ list.
a. Sorted
b. Unsorted
c. Nonlinear
d. None of given
30. If there are 100 elements in an equivalence class, then we will have _______ sets initially.
a. 50
b. 100
c. 1000
d. 80
31. Given the values are the array representation of heap;
12 23 26 31 34 44 56 64 78 100
What is the 5th smallest element in the given heap?
a. 31
b. 34
c. 44
d. 56