100% found this document useful (2 votes)
5K views103 pages

Cs502 Final Term Solved Mcqs by Junaid

The document discusses various algorithms and data structures concepts. It contains 55 multiple choice questions related to topics like matrix multiplication, knapsack problem, greedy algorithms, Huffman coding, graphs and trees. The questions cover concepts such as dynamic programming, divide and conquer strategy, graph representations, matrix operations, sorting algorithms and string encoding.

Uploaded by

Khadija Afzal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
5K views103 pages

Cs502 Final Term Solved Mcqs by Junaid

The document discusses various algorithms and data structures concepts. It contains 55 multiple choice questions related to topics like matrix multiplication, knapsack problem, greedy algorithms, Huffman coding, graphs and trees. The questions cover concepts such as dynamic programming, divide and conquer strategy, graph representations, matrix operations, sorting algorithms and string encoding.

Uploaded by

Khadija Afzal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 103

AL-JUNAID TECH INSTITUTE

1.Which method is preferable for dealing with chain matrix multiplication?


 Divide and conquer strategy
 Dynamic programming formulation
 Graph theory
 Greedy Approach
2.Huffman algorithm produces the…….prefix code tree.
 Better
 Optimal
 Worst
 Best
3.A….w is adjacent to vertex v if there is an edge from v to w.
 Acyclic
 Vertex
 Loop
 Cycle
4. Using ASCII standard the string “greedy” will be encoded with
i. 44 bits
ii. 120 bits
iii. 40 bits
iv. 48 bits
5. Find the maximum value of the items which can carry using knapsack weight capacity
=50

Item weight Value

10 70

20 20

30 80

70 200

i. 90
ii. 280
iii. 200
iv. 100
6. In activity scheduling algorithm, each activity is represented by a
i. Rectangle
ii. Square
AL-JUNAID TECH INSTITUTE
iii. Circle
iv. Triangle

7. Those problems in which greedy finds good, but not always best is called a greedy…..
i. Heuristic
ii. Solution
iii. Result
iv. Algorithm
8. The knapsack problem belongs to the domain of…..Problems
i. Searching
ii. Sorting
iii. Linear solution
iv. Optimization
9. The general coin change problem can be solved using
i. Recursion
ii. Greedy algorithm
iii. Dynamic programming
iv. Divide and conquer
10. Huffman algorithm produces the…………prefix code tree
i. Optimal
ii. Better
iii. Best
iv. Worst
11. Huffman algorithm generates an optimum …..code
i. Postfix
ii. Infix
iii. None of the given options
iv. Prefix
12. …..ways of representing graphics
i. 1
ii. 2
iii. 3
iv. 4
13. Knapsack word originates from ……language
i. German
ii. English
iii. French
iv. Norwegian
14. Graphs are important…….model for many application problems
i. Mathematical
ii. Unpredictable
iii. Haphazard
iv. Unsystematic
15. Which type of algorithm is harder to prove the correctness?
i. Dynamic
AL-JUNAID TECH INSTITUTE
ii. Greedy
iii. Divide and conquer
iv. Brute force
16. …..Items are not allowed in 0/1 knapsack problem
i. Fractional
ii. 0
iii. 1
iv. 0/1
17. Matrix multiplication is a(n)……..operation
i. Nether commutative nor associative
ii. Transitive
iii. Commutative
iv. Associative
18. For a Diagraph G= (V.E), Sum of in-degree (v) -----------------.

• Not equal to sum of out-degree(v)

• = sum of out-degree(v) pg#115

• < sum of out-degree(v)

• > sum of out-degree(v)

19. DFS or BFS yields a-------------of the graph.

• Traversed tree

• Spanning tree pg#125

• Simple tree

• Free tree
20. Using ASCII code, each character is represented by a fixed-length code of-------------bits per
character.
• 4
• 6
 10

• 8 pg#100 21. In Knapsack Problem, the goal is to put items in the Knapsack
such that the value of the items is---------

-------subject to weight limit of the Knapsack.


AL-JUNAID TECH INSTITUTE
• Minimized

• Decreased

• Maximized pg#109

• None of the above given


22. Consider the string”abcdaacac”,if the string is coded with ASCII codes, the message length
would be---

• 70 bits

• 60 bits

• 90 bits

• 72 bits

23. A graph is said to be acyclic if it contains---------.

• At least one cycle

• Exactly one cycle

• Always more than one cycle

• No cycles pg#116

24. The number of edges that come out of a vertex is called the-------------of that vertex in the
digraph.

• Post-degree

• in-degree

• out-degree pg#114

• pre-degree

25. If Matrix-A has dimensions “3x2” and Matrix-B has dimensions “2x3”, then multiplication of
Matrix-A and Matrix-B will result a new Matrix-C having dimensions.

• 3x2

• 2x3

• 2x2

• 3x3pg#87
26. A/an----------is one in which you want to find, not just a solution, but the best solution.
AL-JUNAID TECH INSTITUTE
• Optimization problem

• Divide and Conquer

• NP complete problem

• Best problem
27. Fractional Knapsack is founded on-----------method.

• Greedy page no109

• Recursive

• Divide and Conquer

• Dynamic programming

28. If the graph is represented using an adjacency matrix, then Breadth-first search takes-----------
-time.

• O(E+1)

• O(V^2)

• O(V)

• O(E)

29. In inductive approach of Knapsack problem, we consider 2 cases, ------------or---------------.

• Median, Mode

• Recursive, Iterative

• Leave object, Take object pg#93

• Sequentially, Parallel

30. A Greedy algorithm can NOT be used to solve all the-------------problems.

• Dynamic programming (Google)

• Memorization programming

• Edit-distance programming

• Storing value programming


AL-JUNAID TECH INSTITUTE

31. In Huffman encoding, the---------is the number of occurrences of a character divided by the
total characters in the message.

• Counting

• Parsing

• Relative Probability pg#100

• Weight
32. The Binary Tree constructed by a Huffman Encoding is a:

• Full Binary Tree pg#102

• Partial Binary Tree

• Incomplete Binary Tree

• None of the given option


33. Following is not the application of Edit Distance Problem.

• Speech recognition pg#76

• Spelling correction

• Ascending order

• Computational Molecular Biology


34. Consider three Matrices X, Y, Z of dimensions 1x2, 2x3, 3x4 respectively. The number
of multiplication of(XYZ) is:

• 18

• 32

• 24

• 30
35. In ------------- Knapsack Problem, limitation is that an item can either be put in the bag or
not. Fractional items are not allowed.

a. 0

b. 1

c. 0/1 pg#91

d. Fractional
AL-JUNAID TECH INSTITUTE
36. An in-place sorting algorithm is one that-----------uses additional array for storage.

• Always

• Permanently

• Does not pg#54

• Sometime

37. If Matrix-A has dimensions “pxq” and Matrix-B has dimensions “qxr”, then multiplication of
Matrix-A and Matrix-B will result a new Matrix-C having dimensions.

• Pxq

• Pxr page#84

• qxr

• qxp

38. Counting sort is suitable to sort the elements in range 1 to K.

• K is large

• K is small pg#71

• K may be large or small

• None

39. When matrix A of 5x 3 is multiply with matrix B of 3x 4 then the multiplication required is:

• 15

• 12

• 36

• 60
40. -------------is a linear time sorting algorithm.

• Merge sort

• Quick sort
AL-JUNAID TECH INSTITUTE
• Bubble sort

• Radix sort
41. In Dynamic Programming approach, we do not store the solution to each sub problem in case
if it reappears.

• True

• False page#75
42. Dynamic Programming approach is usually useful in solving optimization problem.

• True page#97

• False
43. Which of the following algorithm provides an optimal solution for the activity selection
problem?

• Divide and Conquer

• Brute force

• Greedy pg#105

• Recursive

44. A graph is---------- if every vertex can reach every other vertex.
 Connected pg#116

• Cycle

• Acyclic

• Loop

45. In a Huffman encoding when a new node is created by combining two nodes, the new node
is placed in the ________.

• Priority queue pg#100

• Linked list

• Min heap tree

• Graph traversal
46. Huffman algorithm produces the _________ prefix code

• Optimal pg#105
AL-JUNAID TECH INSTITUTE
• Best

• Worst

• Better
47. In ________ algorithm, you hope that by choosing a local optimum at each step, you will end
up a global

optimum.

• Simple

• Divide and conquer

• Greedy pg#97

• Brute Force
48. The string “Imncde” is coded with ASCII code, the message length would be ____ bits.

• 24

• 36

• 48
• 60
49. For graph traversal, breadth-first search strategy _________

• Is always recursive

• Cannot br recursive

• Cannot be non-recursive

• Can be both recursive and non-recursive page 119

50. In activity scheduling algorithm , the width of a rectangle __________

• Is always ignored

• Directs towards recursion

• Should be maximized

• Indicates the duration of an activity pg#106

51. If the graph is represented using an adjacency list, then Breadth-first search takes--------- time

• O(V^2)
AL-JUNAID TECH INSTITUTE
• O(V)

• O(V+E) pg#138

• O(E+1)

52. Suppose you are given infinite coins of 1,2 ,3, and 4.Select the ways of the minimum number
of coins that required to achieve a sum of 6:

• 1

• 2 Conceptual

• 3

• 4

53. sing ASCII standard the string “greedy” will be encoded with

• 48 bits Conceptual

• 120 bits

• 44 bits

• 40 bits
54. The Huffman codes provide a method of -------data efficiency.

• Reading/Writing

• Encoding/Decoding pg#99

• Divide/Conquer

• Inserting/Deleting

55. In the context of activity selection algorithm, time s dominated by sorting of the activities by-
-----

• Start Times

• Finish Times pg#106

• Average Times
AL-JUNAID TECH INSTITUTE
• CPU Burst Times

56. Time complexity of the “0-1” knapsack algorithm depends on----

• Number of items
• Capacity of the knapsack

• Size of the Table

• Number of items and capacity of knapsack (confirm)

57. The greedy approach gives us an optimal solution when the coins are all powers of a --------
denomination

• Fixed pg#98

• Variable

• Constant

• Static

58. In Activity Selection, we say that two activities are non-interfering if their start-finish
interval-------overlap
• Do

• Do not pg#105

• Sometimes

• Once
59. How many steps are involved to design the dynamic programming strategy?
• 2

• 3

• 1
• 4 pg#92
60. Bag is a-------------------

• type of algorithm pg#119


• data structure
AL-JUNAID TECH INSTITUTE
• program

• compiler
61. If a problem is in NP-complete, it must also be in NP.
► True page#170
► False
62. The Huffman algorithm finds a optimal solution.

► True pg#105

► False
63. The Huffman algorithm finds an exponential solution
► True
► False pg#105
64. The Huffman algorithm finds a polynomial solution
► True google

► False
65. The greedy part of the Huffman encoding algorithm is to first find two nodes
with smallest frequency.

► True pg#100

► False
66. The code word assigned to characters by the Huffman algorithm have the property that no
code word is the prefix of any other.
► True pg#101

► False
67. Huffman algorithm uses a greedy approach to generate a postfix code T that minimizes the
expected length B (T) of the encoded string.
► True

► False pg#102
68. Dijkestra’s single source shortest path algorithm works if all edges weights are non-negative
and there are negative cost cycles.
► True

► False pg#154
AL-JUNAID TECH INSTITUTE
69. The term “coloring” came form the original application which was in architectural design.
► True

► False pg#176
70. In the clique cover problem, for two vertices to be in the same group, they must be adjacent to
each other.
► True pg#176

► False
71. Dijkstra’s algorithm is operates by maintaining a subset of vertices
► True pg#155
► False
72. We do sorting to,
► keep elements in random positions
► keep the algorithm run in linear order
► keep the algorithm run in (log n) order

► keep elements in increasing or decreasing order pg#40

73. After partitioning array in Quick sort, pivot is placed in a position such that

► Values smaller than pivot are on left and larger than pivot are on right pg#48
► Values larger than pivot are on left and smaller than pivot are on right
 Pivot is the first element of array

► Pivot is the last element of array


74. Merge sort is stable sort, but not an in-place algorithm
► True pg#54

► False
75. A p × q matrix A can be multiplied with a q × r matrix B. The result will be a p × r matrix C.
There are (p . r) total entries in C and each takes _________ to compute.
► O (q) pg#84
► O (1)
► O (n2)
► O (n3)
76. One of the clever aspects of heaps is that they can be stored in arrays without using any

_______________.
AL-JUNAID TECH INSTITUTE
 Pointers pg#40

 constants
 variables
 functions
77. Merge sort requires extra array storage,

 True pg#54
 False
78. The Huffman codes provide a method of encoding data inefficiently when coded using

ASCII standard.

 True
 False pg#99
79. Using ASCII standard the string abacdaacac will be encoded with __________ bits.

 80 pg#99
 160
 320
 100
80. Using ASCII standard the string abacdaacac will be encoded with 160 bits.
 True
 False pg#99
81. Using ASCII standard the string abacdaacac will be encoded with 10 bytes.

 True
 False pg#99
82. The greedy part of the Huffman encoding algorithm is to first find two nodes with

character frequency

 True
 False
83. Huffman algorithm uses a greedy approach to generate an prefix code T that minimizes

the expected length B (T) of the encoded string.

 True pg#100
 False

84. An optimization problem is one in which you want to find,


► Not a solution
► An algorithm
► Good solution
► The best solution pg#97
85. Although it requires more complicated data structures, Prim's algorithm for a minimum
spanning tree is better than Kruskal's when the graph has a large number of vert
► True pg#149
► False
AL-JUNAID TECH INSTITUTE
86. If a problem is in NP, it must also be in P.
► True

► False
► unknown pg#173
87. What is generally true of Adjacency List and Adjacency Matrix representations of graphs?

► Lists require less space than matrices but take longer to find the weight of an edge
(v1,v2) pg#116
► Lists require less space than matrices and they are faster to find the weight of an edge (v1,v2)
► Lists require more space than matrices and they take longer to find the weight of an edge
(v1,v2)
► Lists require more space than matrices but are faster to find the weight of an edge (v1,
88. If a graph has v vertices and e edges then to obtain a spanning tree we have to delete
► v edges.

► v – e + 5 edges
► v + e edges.

► None of these
89. Maximum number of vertices in a Directed Graph may be |V 2|
► True

► False pg#115
90. The Huffman algorithm finds a (n) _____________ solution.

► Optimal pg#105

► Non-optimal
► Exponential
► Polynomial
91. The Huffman algorithm finds an exponential solution
► True

► False pg#115

92. Edge (u, v) is a forward edge if


► u is a proper descendant of v in the tree
► v is a proper descendant of u in the tree pg#129
► None of these
93. After partitioning array in Quick sort, pivot is placed in a position such that
AL-JUNAID TECH INSTITUTE
► Values smaller than pivot are on left and larger than pivot are on right (Page 48)

► Values larger than pivot are on left and smaller than pivot are on right

► Pivot is the first element of array

► Pivot is the last element of array


94. Merge sort is stable sort, but not an in-place algorithm
► True Page #54

► False
95. In counting sort, once we know the ranks, we simply _________ numbers to their final
positions in an output array.
► Delete

► copy Page# 57
► Mark
► arrange
96. . Dynamic programming algorithms need to store the results of intermediate sub-problems.

► True pg#75
► False
97. . A p × q matrix A can be multiplied with a q × r matrix B. The result will be a p × r matrix C.
There are (p . r) total entries in C and each takes _________ to compute.

► O (q) pg#48
► O (1)
► O (n2)
► O (n3)
98. ._______________ is a graphical representation of an algorithm

►  notation

►  notation

► Flowchart

► Asymptotic notation

99. .Which of the following is calculated with big o notation?


AL-JUNAID TECH INSTITUTE
 ►Lower bounds
 ►Upper bounds pg#25
 ►Both upper and lower bound
 ►Medium bounds
100. Merge sort makes two recursive calls. Which statement is true after these recursive
calls finish, but before the merge step?

 ►The array elements form a heap


 ►Elements in each half of the array are sorted amongst themselves
 ►Elements in the first half of the array are less than or equal to elements in the second half of the
array
 ►None of the above
101. What is the solution to the recurrence T(n) = T(n/2)+n, T(1) = 1

 ►O(logn)
 ►O(n) pg#37

 ►O(nlogn)
 ►O(2n)
102. Consider the following Huffman Tree

The binary code for the string TEA is

 ►10 00 010
 ►011 00 010
 ►10 00 110
 ►11 10 110
103. .A greedy algorithm does not work in phases.

►True

►False pg#97

104. Can an adjacency matrix for a directed graph ever not be square in shape?

►Yes
►No pg#116
105. 44.One of the clever aspects of heaps is that they can be stored in arrays without using
any____________.

►Pointers pg#40
►constants
►variables
►functions
106. .Merge sort requires extra array storage,
AL-JUNAID TECH INSTITUTE
►True Page 54
►False
107. .Non-optimal or greedy algorithm for money change takes____________

 ►O(k) Pg #99
 ►O(kN)
 ►O(2k)
 ►O(N)
108. The Huffman codes provide a method of encoding data inefficiently when coded
using ASCII standard.

 ►True
 ►False Pg# 99
109. Using ASCII standard the string abacdaacac will be encoded with __________ bits.

 ►80 pg# 99
 ►160
 ►320
 ►100
110. Using ASCII standard the string abacdaacac will be encoded with 160 bits.

 ►True
 ►False (Pg# 99)
111. Using ASCII standard the string abacdaacac will be encoded with 320 bits.

 ►True
 ►False (Pg# 99)
112. .Using ASCII standard the string abacdaacac will be encoded with 100 bits.

 ►True
 ►False (Pg# 99)
113. Using ASCII standard the string abacdaacac will be encoded with 32 bytes

 ►True
 ►False (Pg# 99) 8bytes
114. The greedy part of the Huffman encoding algorithm is to first find two nodes with
smallest frequency.

 ►True (Pg# 100)


 ►False
115. The greedy part of the Huffman encoding algorithm is to first find two nodes with
character frequency

 ►True
 ►False (Pg# 100)
AL-JUNAID TECH INSTITUTE
116. .Huffman algorithm uses a greedy approach to generate an antefix code T that
minimizes the expected length B (T) of the encoded string.

 ►True
 ►False (Pg# 102)
117. Depth first search is shortest path algorithm that works on un-weighted graphs.

►True
►False (Pg# 159)

118. Floyd-Warshall algorithm is a dynamic programming algorithm; the genius of the


algorithm is in the clever recursive formulation of the shortest path problem.

►True (Pg# 162)


►Flase
119. .Floyd-Warshall algorithm, as in the case with DP algorithms, we avoid recursive
evaluation by generating a table for

 ►k
 ► dijk (Pg# 164)
 ►True
 ►Flase
120. .The term coloring came from the original application which was in map drawing.

 ►True (Pg# 176)


 ►False
121. In the clique cover problem, for two vertices to be in the same group, they must
be_______________each other.

 ►Apart from
 ►Far from
 ►Near to
 ►Adjacent to (Pg# 176)
122. . Fixed-length codes may not be efficient from the perspective of _______the total
quantity of data.

Select correct option:

►Minimizing Pg# 99

►Averaging

►Maximizing

►Summing

123. In greedy algorithm, at each phase, you take the________ you can get right now,
without regard for future consequences.
AL-JUNAID TECH INSTITUTE
►Worst

►Minimum

►Good

►Best Page #97

124. The difference between Prim s algorithm and Dijkstra s algorithm is that Dijkstra s
algorithm uses a same key.

►True
►False Page# 156
125. If a problem is in NP-complete, it must also be in NP.

► True Page# 178


► False
126. If there are n items, there are _______ possible combinations of the items.

►2

►n

►2^n Page# 92

►3^n

127. .Using ASCII code, each character is represented by a fixed-length code word of
________ bits per character.

►4

►6

►8 pg # 99

►10

128. .In Knapsack Problem, the thief’s goal is to put items in the bag such that the ______
of the items does not exceed the limit of the bag.

►Value Page #91

►Weight

►Length

►Balance

129. The knapsack problem does not belong to the domain of optimization problems.
AL-JUNAID TECH INSTITUTE
►True

►False Page# 91

130. .In Huffman encoding, for a given message string, the frequency of occurrence
(relative probability) of each character in the message is determined last.

►True

►False Page 100

131. Fixed-length codes are known for easy break up of a string into its individual
characters.

►True Page# 99

►False

132. In ______ Knapsack Problem, limitation is that an item can either be put in the bag or
not-fractional items are not allowed.

►0

►1

►0/1 Page# 91

►Fractional

133. In Knapsack Problem, value and weight both are to be under consideration.

►True page #91

►False

134. Time complexity of DP based algorithm for computing the minimum cost of chain
matrix Multiplication is ________ .

►log n

►n

►n2

►n3 Page #90

135. In DP based solution of knapsack problem, to compute entries of V we will imply a/an
_______ approach.

►Subjective

►Inductive Page #93

►Brute force
AL-JUNAID TECH INSTITUTE
►Combination

136. A greedy algorithm sometimes works well for optimization problems.

►True Page# 97

►False

137. In Huffman encoding, frequency of each character can be determined by parsing the
message and __________ how many times each character (or symbol) appears.

►Printing

►Incrementing

►Counting (Page 100)

►Deleting

138. Greedy algorithm can do very poorly for some problems.

►True Page# 97

►False

139. The Huffman codes provide a method of _________ data efficiently.

►Reading

►Encoding Page# 99

►Decoding

►Printing

140. In _______ based solution of knapsack problem, we consider 2 cases, Leave object
Or Take object.

►Brute force

►Dynamic programming Page #93

141. Those problems in which Greedy finds good, but not always best is called a
greedy________.

►Algorithm

►Solution

►Heuristic Page# 97

►Result
AL-JUNAID TECH INSTITUTE
142. In brute force based solution of knapsack problem, we consider 2 cases, Leave object
Or Take object.

►TRUE

►FALSE Page# 97

143. .________ problem, we want to find the best solution.

►Minimization

►Averaging

►Optimization Page# 97

►Maximization

144. Using ASCII standard the string abacdaacac will be encoded with 10 bytes.
►True Page #101
►False
145. In _______ algorithm, you hope that by choosing a local optimum at each step, you
will end up at a global optimum.
►Simple

►Non Greedy

►Greedy Page# 97

►Brute force

146. Huffman algorithm uses a greedy approach to generate an prefix code T that
minimizes the expected length B (T) of the encoded string.

►True Page# 102


►False
147. Counting Money problem is an example which cannot be optimally solved by greedy
algorithm.

►True Page# 97

►False

148. Huffman algorithm generates an optimum prefix code.

►True Page# 102

►False

149. If the string “lmncde” is coded with ASCII code, the message length would be
_______ bits.

►24
AL-JUNAID TECH INSTITUTE
►36

►48 6*8=48 page #99

►60

150. There are _________ nested loops in DP based algorithm for computing the minimum
cost of chain matrix multiplication.

►2

►3 Page# 90

►4

151. .A number of lectures are to be given in a single lecture hall. Optimum scheduling for
this is an example of Activity selection.

►True Page# 105

►False

152. The activity scheduling is a simple scheduling problem for which the greedy
algorithm approach provides a/an ________solution.

►Simple

►Sub optimal

►Optimal Page# 105

►Non optimal

153. The string |xyz|, if coded with ASCII code, the message length would be 24 bits.

►True (3*8=24) page#99

►False

154. An application problem is one in which you want to find, not just a solution, but the
____ solution.

►Simple

►Good Page #113

►Best

155. Suppose that a graph G = (V,E) is implemented using adjacency lists. What is the
complexity of a breadth-first traversal of G?

►O(|V |^2)
AL-JUNAID TECH INSTITUTE
►O(|V | |E|)

►O(|V |^2|E|)

►O(|V | + |E|) pg #116

156. Which is true statement?

►Breadth first search is shortest path algorithm that works on un-weighted graphs Page
#153

►Depth first search is shortest path algorithm that works on un-weighted graphs.

►Both of above are true.

►None of above are true.

157. .Forward edge is:

► (u, v) where u is a proper descendent of v in the tree.

► (u, v) where v is a proper descendent of u in the tree. Page #129

► (u, v) where v is a proper ancesstor of u in the tree.

► (u, v) where u is a proper ancesstor of v in the tree.

158. If you find yourself in maze the better traversal approach will be :

►BFS google

►BFS and DFS both are valid

►Level order

►DFS

159. .In digraph G=(V,E) ;G has cycle if and only if

►The DFS forest has forward edge.

►The DFS forest has back edge Page#131

►The DFS forest has both back and forward edge

►BFS forest has forward edge

160. .Back edge is:

► (u, v) where v is an ancestor of u in the tree. Page# 128

► (u,v) where u is an ancesstor of v in the tree.

► (u, v) where v is an predcessor of u in the tree.


AL-JUNAID TECH INSTITUTE
►None of above

161. Cross edge is :

► (u, v) where u and v are not ancestor of one another

► (u, v) where u is ancesstor of v and v is not descendent of u.

► (u, v) where u and v are not ancestor or descendent of one another Page# 129

► (u, v) where u and v are either ancestor or descendent of one another.

162. Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose best
tree edge) when the graph has relatively few edges.

►True google

►False

163. What algorithm technique is used in the implementation of Kruskal solution for the
MST?

►Greedy Technique Page# 142

►Divide-and-Conquer Technique

►Dynamic Programming Technique

►The algorithm combines more than one of the above techniques

164. What is the time complexity to extract a vertex from the priority queue in Prim’s
algorithm?

►O (log E)

► (V)

► (V+E)

►O (log V) Page #152

165. The relationship between number of back edges and number of cycles in DFS is,

►Both are equal

►Back edges are half of cycles

►Back edges are one quarter of cycles

►There is no relationship between no. of edges and cycles Page# 131

166. You have an adjacency list for G, what is the time complexity to compute Graph
transpose G^T.?

► (V + E) Page# 138
AL-JUNAID TECH INSTITUTE
► (V E)

► (V)

► (V^2)

167. There is relationship between number of back edges and number of cycles in DFS

►Both are equal.

►Cycles are half of back edges.

►Cycles are one fourth of back edges.

►There is no relationship between back edges and number of cycles. Page# 131

168. A digraph is strongly connected under what condition?

►A digraph is strongly connected if for every pair of vertices u, v e V, u can reach v .

►A digraph is strongly connected if for every pair of vertices u, v e V, u can reach v and vice
versa. Page# 135

►A digraph is strongly connected if for at least one pair of vertex u, v e V, u can reach v and vice
versa.

►A digraph is strongly connected if at least one third pair of vertices u, v e V, u can reach v and
vice versa.
169. In in-place sorting algorithm is one that uses arrays for storage :
►An additional array

►No additional array Page#54

►Both of above may be true according to algorithm

► More than 3 arrays of one dimension.

170. In stable sorting algorithm

►One array is used

► In which duplicating elements are not handled.

►More than one arrays are required.

►Duplicating elements remain in same relative position after sorting. Page# 54

171. Which sorting algorithm is faster :

►O(n^2)

►O(nlogn) Page# 46

►O(n+k)
AL-JUNAID TECH INSTITUTE
►O(n^3)

172. In Quick sort algorithm, constants hidden in T(n lg n) are

►Large

►Medium

►Not known

►Small

173. Quick sort is based on divide and conquer paradigm; we divide the problem on base of
pivot element and:

►There is explicit combine process as well to conquer the solution.


►No work is needed to combine the sub-arrays, the array is already sorted
►Merging the sub arrays
►None of above. Page# 51

174. . Dijkstra’s algorithm :

►Has greedy approach to find all shortest paths


►Has both greedy and Dynamic approach to find all shortest paths
►Has greedy approach to compute single source shortest paths to all other vertices Page#
154

► Has both greedy and dynamic approach to compute single source shortest paths to all other
vertices.
175. Which may be stable sort:

►Bubble sort
►Insertion sort
►Both of above page# 54
►Selection sort

176. In the analysis of Selection algorithm, we eliminate a constant fraction of the array with each
phase; we get the convergent _______________ series in the analysis,

►linear
►arithmetic
►geometric page #37
►exponent
177. How much time merge sort takes for an array of numbers?
►T(n^2)
►T(n) Page# 40
►T( log n)
►T(n log n)

178. Dijkstra’s algorithm is operates by maintaining a subset of vertices


AL-JUNAID TECH INSTITUTE
 True Page# 155
 False
179. The difference between Prim’s algorithm and Dijkstra’s algorithm is that Dijkstra’s algorithm
uses a different key.
►True Page# 156

► False
180. Consider the following adjacency list:

Which of the following graph(s) describe(s) the above adjacency list?


AL-JUNAID TECH INSTITUTE

► Correct Option pg#116


181. We do sorting to,
► keep elements in random positions
► keep the algorithm run in linear order
 ► keep the algorithm run in (log n) order
 ► keep elements in increasing or decreasing order Page# 40

182. . After partitioning array in Quick sort, pivot is placed in a position such that

 ► Values smaller than pivot are on left and larger than pivot are on right
Page# 48
 ► Values larger than pivot are on left and smaller than pivot are on right
 ► Pivot is the first element of array
 ► Pivot is the last element of array
183. . Merge sort is stable sort, but not an in-place algorithm

 ► True (Page# 54)


 ► False
184. In counting sort, once we know the ranks, we simply _________ numbers to their final
positions in an output array.
 ► Delete
 ► copy (Page# 57)
 ► Mark
 ► arrange
185. Dynamic programming algorithms need to store the results of intermediate sub-problems.
 ► True (Page# 75)
 ► False
AL-JUNAID TECH INSTITUTE
186. A p × q matrix A can be multiplied with a q × r matrix B. The result will be a p × r matrix C.
There are (p . r) total entries in C and each takes _________ to compute.
 ► O (q) (Page# 84)
 ► O (1)
 ► O (n2)
 ► O (n3)
187. _______________ is a graphical representation of an algorithm

 ►  notation
 ►  notation
 ► Flowchart
 ► Asymptotic notation
188. Which of the following is calculated with big o notation?

 ►Lower bounds
 ►Upper bounds (Page# 25)
 ►Both upper and lower bound
 ►Medium bounds

189. Merge sort makes two recursive calls. Which statement is true after these
recursive calls finish, but before the merge step?
 ►The array elements form a heap
 ►Elements in each half of the array are sorted amongst themselves
 ►Elements in the first half of the array are less than or equal to elements in the second half of
the array
 ►None of the above
190. Non-optimal or greedy algorithm for money change takes____________

 ►O(k) (Page #99)


 ►O(kN)
 ►O(2k)
 ►O(N)
191. The Huffman codes provide a method of encoding data inefficiently when
coded using ASCII standard.
 ►True
 ►False (Page# 99)
192. Using ASCII standard the string abacdaacac will be encoded with __________
bits.

 ►80 (Page #99)


 ►160
AL-JUNAID TECH INSTITUTE
 ►320
 ►100
193. Using ASCII standard the string abacdaacac will be encoded with 160 bits.

 ►True
 ►False (Page #99)
194. using ASCII standard the string abacdaacac will be encoded with 32 bytes

►True
►False (Page #99)
195. The greedy part of the Huffman encoding algorithm is to first find two nodes
with smallest frequency.

►True (Page #100)


►False
196. The greedy part of the Huffman encoding algorithm is to first find two nodes
with character frequency

►True
►False (Page# 100)
197. Huffman algorithm uses a greedy approach to generate an antefix code T that
minimizes the expected length B (T) of the encoded string.

►True
►False (Page #102)
198. Depth first search is shortest path algorithm that works on un-weighted graphs.

►True
►False (Page# 153)

199. 12Dijkstras single source shortest path algorithm works if all edges weights
are non negative and there are no negative cost cycles.

►True (Page#159)
►False
200. Dijkestra s single source shortest path algorithm works if all edges weights are
negative and there are no negative cost cycles.

►True
►False (Page #159)
201. Floyd-Warshall algorithm is a dynamic programming algorithm; the genius of
the algorithm is in the clever recursive formulation of the shortest path problem.

►True (Page #162)


AL-JUNAID TECH INSTITUTE
►False
202. Floyd-Warshall algorithm, as in the case with DP algorithms, we avoid
recursive evaluation by generating a table for

►k
► dijk (Page# 164)
►True
►False
203. the term coloring came from the original application which was in map
drawing.

►True (Page #176)


►False
204. In the clique cover problem, for two vertices to be in the same group, they
must be_______________each other.

►Apart from
►Far from
►Near to
►Adjacent to (Page# 176)
205. Fixed-length codes may not be efficient from the perspective of
_______the total quantity of data.

Select correct option:

►Minimizing (Page #99)

►Averaging

►Maximizing

►Summing

206. In greedy algorithm, at each phase, you take the________ you can get right
now, without regard for future consequences.

►Worst

►Minimum

►Good

►Best (Page #97)

207. The difference between Prim s algorithm and Dijkstra s algorithm is that
Dijkstra s algorithm uses a same key.

►True
►False ( Page# 156)
208. If a problem is in NP-complete, it must also be in NP.
AL-JUNAID TECH INSTITUTE
► True (Page #178)
► False
209. If there are n items, there are _______ possible combinations of the items.
 ►2
 ►n
 ►2^n (Page# 92)
 ►3^n
210. Using ASCII code, each character is represented by a fixed-length code word
of ________ bits per character.
 ►4
 ►6
 ►8 (Page #99)
 ►10
211. In Knapsack Problem, the thief’s goal is to put items in the bag such that the
______ of the items does not exceed the limit of the bag.
 ►Value (Page# 91)
 ►Weight
 ►Length
 ►Balance
212. The knapsack problem does not belong to the domain of optimization
problems.
 ►True
 ►False (Page# 91)
213. In Huffman encoding, for a given message string, the frequency of occurrence
(relative probability) of each character in the message is determined last.
 ►True
 ►False (Page #100)
214. Fixed-length codes are known for easy break up of a string into its individual
characters.

►True (Page# 99)

►False

215. In ______ Knapsack Problem, limitation is that an item can either be put in the
bag or not-fractional items are not allowed.
 ►0
 ►1
 ►0/1 (Page# 91)
 ►Fractional
216. The term “coloring” came from the original application which was in
architectural design.
 ► True
 ► False (Page# 173)
217. In Knapsack Problem, value and weight both are to be under consideration.
 ►True (page# 91)
AL-JUNAID TECH INSTITUTE
 ►False
218. Time complexity of DP based algorithm for computing the minimum cost of
chain matrix Multiplication is ________ .
 ►log n
 ►n
 ►n2
 ►n3 (Page# 90)
219. In DP based solution of knapsack problem, to compute entries of V we will
imply a/an _______ approach.
 ►Subjective
 ►Inductive (Page# 93)
 ►Brute force
 ►Combination
220. A greedy algorithm sometimes works well for optimization problems.
►True (Page# 97)
►False
221. In Huffman encoding, frequency of each character can be determined by
parsing the message and __________ how many times each character (or symbol)
appears.

 ►Printing
 ►Incrementing
 ►Counting (Page# 100)
 ►Deleting
222. .Greedy algorithm can do very poorly for some problems.
 ►True (Page# 97)
 ►False
223. The Huffman codes provide a method of _________ data efficiently.
 ►Reading
 ►Encoding (Page# 99)
 ►Decoding
 ►Printing
224. In _______ based solution of knapsack problem, we consider 2 cases, Leave
object Or Take object.

 ►Brute force
 ►Dynamic programming (Page #93)
225. Those problems in which Greedy finds good, but not always best is called a
greedy________.
 ►Algorithm
 ►Solution
 ►Heuristic (Page# 97)
 ►Result
AL-JUNAID TECH INSTITUTE
226. In brute force based solution of knapsack problem, we consider 2 cases, Leave
object Or Take object.
 ►TRUE
 ►FALSE (Page# 97)
227. ________ problem, we want to find the best solution.
 ►Minimization
 ►Averaging
 ►Optimization (Page#97)
 ►Maximization
228. Using ASCII standard the string abacdaacac will be encoded with 10 bytes.
 ►True (Page# 101)
 ►False
229. In _______ algorithm, you hope that by choosing a local optimum at each step,
you will end up at a global optimum.
 ►Simple
 ►Non Greedy
 ►Greedy (Page# 97)
 ►Brute force
230. Huffman algorithm uses a greedy approach to generate an prefix code T that
minimizes the expected length B (T) of the encoded string.
 ►True (Page #102)
 ►False
231. How many elements do we eliminate in each time for the Analysis of Selection
algorithm?
►n / 2 elements (Page #37)
► (n / 2) + n elements
►n / 4 elements
►2 n elements

232. Slow sorting algorithms run in,


►T(n^2) (Page #39)
►T(n)
►T( log n)
►T(n log n)
233. Counting sort is suitable to sort the elements in range 1 to k:
►K is large
►K is small (Page# 57)
►K may be large or small
►None
234. Heaps can be stored in arrays without using any pointers; this is due to the
____________ nature of the binary tree,

►left-complete (Page# 40)


►right-complete
►tree nodes
►tree leaves
235. Sieve Technique can be applied to selection problem?
►True (Page#35)
►False
AL-JUNAID TECH INSTITUTE
236. A heap is a left-complete binary tree that conforms to the ___________

►increasing order only


►decreasing order only
►heap order (Page# 40)
► (log n) order
237. Divide-and-conquer as breaking the problem into a small number of
►pivot
►Sieve
►smaller sub problems (Page #34)
►Selection
238. In Sieve Technique we do not know which item is of interest
►True (Page# 34)
►False
239. The recurrence relation of Tower of Hanoi is given below T(n)={1 if n=1 and
2T(n-1) if n >1 In order to move a tower of 5 rings from one peg to another, how
many ring moves are required?

►16
►10
►32
►31
240. For the heap sort, access to nodes involves simple _______________
operations.

►arithmetic ( Page# 41)


►binary
►algebraic
►logarithmic
241. For the sieve technique we solve the problem,
►recursively (Page# 34)
►mathematically
►precisely
►accurately
 242. The sieve technique works in ___________ as follows

►phases (Page #34)


►numbers
►integers
►routines
243. A (an) _________ is a left-complete binary tree that conforms to the heap
order
►heap (Page# 40)
►binary tree
►binary search tree
►array
244. The sieve technique is a special case, where the number of sub problems is
just
►5
►many
AL-JUNAID TECH INSTITUTE
►1 (Page #34)
►few
245. Analysis of Selection algorithm ends up with,

►T(n)
►T(1 / 1 + n)
►T(n / 2)
►T((n / 2) + n) (Page #37)
246. For the heap sort we store the tree nodes in
►level-order traversal (Page #40)
►in-order traversal
►pre-order traversal
►post-order traversal
247. The reason for introducing Sieve Technique algorithm is that it illustrates a
very important special case of,
►divide-and-conquer (Page# 34)
►decrease and conquer
►greedy nature
►2-dimension Maxima
248. Theta asymptotic notation for T (n) :

►Set of functions described by: c1g(n)Set of functions described by c1g(n)>=f(n) for


c1 s
►Theta for T(n)is actually upper and worst case comp
►Set of functions described by:
►c1g(n
249. Sieve Technique applies to problems where we are interested in finding a
single item from a larger set of _____________

►n items (Page# 34)


►phases
►pointers
►constant
250. Memorization is?

►To store previous results for future use


►To avoid this unnecessary repetitions by writing down the results of recursive calls and
looking them up again if we need them later (Page# 47)
►To make the process accurate
►None of the above
251. Quick sort is

►Stable & in place


►Not stable but in place (Page#57)
►Stable but not in place
►Some time stable & some times in place
252. One example of in place but not stable algorithm is
AL-JUNAID TECH INSTITUTE
►Merger Sort
►Quick Sort (Page# 54)
►Continuation Sort
►Bubble Sort
253. . Continuation sort is suitable to sort the elements in range 1 to k
►K is Large
►K is not known
►K may be small or large
►K is small (Page# 57)

254. Which may be a stable sort?

►Merger
►Insertion
► Both above (Page #54)
►None of the above
255. . An in place sorting algorithm is one that uses ___ arrays for storage
►Two dimensional arrays
►More than one array
►No Additional Array (Page #54)
►None of the above
256. Continuing sort has time complexity of ?

►O(n
►O(n+k)
►O(nlogn)
►O(k)
257. single item from a larger set of _____________
►n items (Page# 34)
►phases

►pointers
►v constant
258. For the Sieve Technique we take time

►T(nk) ( Page# 34)


►T(n / 3)
►n^2
►n/3
259. One Example of in place but not stable sort is

►Quick (Page# 54)


►Heap
►Merge
►Bubble
260. Consider the following Algorithm:
Factorial (n){

if (n=1)

return 1
AL-JUNAID TECH INSTITUTE
else

return (n * Factorial(n-1))

Recurrence for the following algorithm is:

 ► T(n) = T(n-1) +1
 ► T(n) = nT(n-1) +1
 ► T(n)= T(n-1) +n
 ► T(n)=T(n(n-1)) +1
261. Due to left complete nature of binary tree, the heap can be stored in
 ► Arrays (Page #40)
 ► Structures
 ► Link List
 ►Stack
262. What type of instructions Random Access Machine (RAM) can execute?
 ►Algebraic and logic
 ►Geometric and arithmetic
 ►Arithmetic and logic (Page# 10)
 ►Parallel and recursive
263. What is the total time to heapify?
 ► Ο(log n) (Page 43)
 ► Ο(n log n)
 ► Ο(n2 log n)
 ► Ο(log2 n)
264. word Algorithm comes from the name of the muslim author ____________
 ►Abu Ja’far Mohammad ibn Musa al-Khowarizmi.
265. Al-Khwarizmi’s work was written in a book titled _______________
 ►al Kitab al-mukhatasar fi hisab al-jabr wa’l-muqabalah
266. Random access machine or RAM is a/an
 ► Machine build by Al-Khwarizmi
 ► Mechanical machine
 ► Electronics machine
 ► Mathematical model (Page# 10)
267. A RAM is an idealized machine with ______________ random-access
memory.
 ► 256MB
 ► 512MB
 ► an infinitely large (Page #10)
 ► 100GB
268. What will be the total number of max comparisons if we run brute-force
maxima algorithm with n elements?
2
 ► n
n

 ►n
2

 ►n (Page# 14)
8
AL-JUNAID TECH INSTITUTE
 ►n
269. Consider the following code:

For(j=1; j<n;j++)

For(k=1; k<15;k++)

For(l=5; l<n; l++)

Do_something_constant();

What is the order of execution for this code.

 ► O(n)
 ► O(n3)
 ► O(n2 log n)
 ► O(n2)
270. Is it possible to sort without making comparisons?
 ► Yes (Page# 57)
 ► No
271. When we call heapify then at each level the comparison performed takes time
 ► It will take Θ (1) (Page# 43)
 ► Time will vary according to the nature of input data
 ► It can not be predicted
 ► It will take Θ (log n)
272. In Quick sort, we don’t have the control over the sizes of recursive calls
 ► True (Page# 40)
 ► False
 ► Less information to decide
 ► Either true or false
273. For Chain Matrix Multiplication we cannot use divide and conquer approach
because,
 ► We do not know the optimum k (Page# 86)
 ► We use divide and conquer for sorting only
 ► We can easily perform it in linear time
 ► Size of data is not given
274. The Knapsack problem belongs to the domain of _______________ problems.
 ► Optimization (Page# 91)
 ► NP Complete
 ► Linear Solution
 ► Sorting
275. Suppose we have three items as shown in the following table, and suppose the
capacity of the knapsack is 50 i.e. W = 50.
AL-JUNAID TECH INSTITUTE
Item Value Weight

1 60 10

2 100 20

3 120 30

The optimal solution is to pick

 ► Items 1 and 2
 ► Items 1 and 3
 ► Items 2 and 3
 ► None of these
276. who invented the quick sort
 ►C.A.R. Hoare
277. main elements to a divide-and-conquer
 ►Divide, conquer, combine (Page# 27)
278. Mergesort is a stable algorithm but not an in-place algorithm.

 ►True (Page# 54)


 ►false
279. Counting sort the numbers to be sorted are in the range 1 to k where k is small.
 ►True (Page# 57)
 ►False
280. In selection algorithm, because we eliminate a constant fraction of the array
with each phase, we get the
 ►Convergent geometric series (Page 37)
 ►Divergent geometric series
 ►None of these
281. .In RAM model instructions are executed
 ►One after another (Page# 10)
 ►Parallel
AL-JUNAID TECH INSTITUTE
 ►Concurrent
 ►Random
282. Due to left-complete nature of binary tree, heaps can be stored in
 ►Link list
 ►Structure
 ►Array (Page# 40)
 ►None of above
283. The time assumed for each basic operation to execute on RAM model of
computation is-----
 ►Infinite
 ►Continuous
 ►Constant (Page# 10)
 ►Variable
284. If the indices passed to merge sort algorithm are not equal, the algorithm may
return immediately.
 ►True
 ►False (Page# 28)
285. Brute-force algorithm uses no intelligence in pruning out decisions.
 ►True (Page #18)
 ►False
286. In analysis, the Upper Bound means the function grows asymptotically no
faster than its largest term.
 ►True (Page #24)
 ►False
287. For small values of n, any algorithm is fast enough. Running time does
become an issue when n gets large.
 ►True (Page #14)
 ►False
288. In simple brute-force algorithm, we give no thought to efficiency.
 ►True (Page# 11)
 ►False
289. The ancient Roman politicians understood an important principle of good
algorithm design that is plan-sweep algorithm.
 ►True
 ►False (Page# 27)
290. In 2d-space a point is said to be ________if it is not dominated by any other
point in that space.
 ►Member
 ►Minimal
 ►Maximal (Page# 11)
 ►Joint
291. An algorithm is a mathematical entity that is dependent on a specific
programming language.
 ► True
 ►False (Page# 7)
AL-JUNAID TECH INSTITUTE
292. The running time of an algorithm would not depend upon the optimization by
the compiler but that of an implementation of the algorithm would depend on it.

 ►True (Page# 13)


 ►False
293. F (n) and g (n) are asymptotically equivalent. This means that they have
essentially the same __________ for large n.
 ►Results
 ►Variables
 ►Size
 ►Growth rates (Page#23)
294. 8n2 + 2n - 3 will eventually exceed c2*(n) no matter how large we make c2.
 ►True (Page# 25)
 ►False
295. If we associate (x, y) integers pair to cars where x is the speed of the car and y
is the negation of the price. High y value for a car means a ________ car.
 ►Fast
 ►Slow
 ►Expensive
 ►Cheap (Page# 11)
296. The function f(n)= n(logn+1)/2 is asymptotically equivalent to n log n. Here
Upper Bound means the function f(n) grows asymptotically ____________ faster than
n log n.
► More
►Quiet
►Not (Page# 24)
►At least
297. Counting Money problem is an example which cannot be optimally solved by
greedy algorithm.
 ►True (Page# 97)
 ►False
298. Huffman algorithm generates an optimum prefix code.
 ►True (Page #102)
 ►False
299. If the string “lmncde” is coded with ASCII code, the message length would be
_______ bits.
 ►24
 ►36
 ►48 (6*8=48)
 ►60
300. There are _________ nested loops in DP based algorithm for computing the
minimum cost of chain matrix multiplication.
 ►2
 ►3 (Page# 90)
AL-JUNAID TECH INSTITUTE
 ►4
 ►5
301. Inductive approach to compute entries of V is implied in _____ based solution
of knapsack problem.
 ►Brute force
 ►Dynamic programming (Page #93)
302. A number of lectures are to be given in a single lecture hall. Optimum
scheduling for this is an example of Activity selection.
 ►True (Page# 105)
 ►False
303. The activity scheduling is a simple scheduling problem for which the greedy
algorithm approach provides a/an ________solution.
 ►Simple
 ►Sub optimal
 ►Optimal (Page# 105)
 ►Non optimal
304. The string |xyz|, if coded with ASCII code, the message length would be 24
bits.
 ►True (3*8=24)
 ►False
305. An application problem is one in which you want to find, not just a solution,
but the ____ solution.
 ►Simple
 ►Good (Page# 113)
 ►Best
 ►Worst
306. A free tree with n vertices has exactly _______edges.

a. n

b. n+1

c. n-1 page 142


1
307. Kruskal`s algorithm works by adding ______ in increasing order of weight
(lightest edge first)

a. Verticals

b. Edges page 147


• Trees

• Weights

308. Computing the strongly connected components of a digraphs is a/an _____


of the problem to determine whether a diagraph is strongly connected or not
AL-JUNAID TECH INSTITUTE
a. Size
b. Generalization page 135
• Optimization
• Connection

309. The process of updating estimates in Dijkstra`s algorithm is called ______

a. Updating

b. Amendment

c. Relaxation page 154


• Insertion
310. An un-weighted graph can be considered as a graph in which every
edge has weight_______ Unit.
a. 7
b. 5
c. 3
d. 1 page 153
311. The breadth-first-search algorithm is a shortest-path algorithm that works
on______graphs.

a. Weighted

b. Directed

c. Un-weighted page 153


d. Un-directed
AL-JUNAID TECH INSTITUTE
312. Which activity creates a unique cycle in a free tree:
a. adding any vertex
b. adding any sub tree
c. adding root
d. adding any edge page 142

313. The relationship between number of back edges and Number of cycles in DFS is,

a. Both are equal

b. Back edges are half of cycles

c. Back edges are one quarter of cycles

d. There is no relationship between no. of edges and cycles google

314. From given algorithms which one considered as best for finding the shortest-path:

 DFS

 Bellman-Ford algorithm

 Dijkstra's algorithm page 154 / google

 BFS
315. Overall time for Kruskal
algorithm is
a. Θ(log E)

b. Θ(E log V) page 149 / google

c. Θ(E log E)

d. Θ(V log E)

316. Dijkstra's Algorithm is used to solve_______ problems.

a. All-pair shortest path

b. Single-source shortest path page 154

• Multi-source shortest path

• Sorting & searching


AL-JUNAID TECH INSTITUTE
317. A digraph is strongly connected under what condition?

 A digraph is strongly connected if for every pair of vertices u, v e V, u cancreach v.

 A digraph is strongly connected if for every pair of vertices u, v e V, u can

reach v and vice versa. Page 135

 A digraph is strongly connected if for at least one pair of vertex u, v e V, u can reach v and
vice versa.

 A digraph is strongly connected if at least one third pair of vertices u, v e V, u can reach v and
vice versa.
AL-JUNAID TECH INSTITUTE
318. Floyd-Warshall Algorithm is based on ______________

a. Dynamic Programming page 161


• Greedy Approach

• Divide and Conquer

• Complexity theory

319. . In strong components algorithm, vertices are sorted in ___________order of


finish times.
a. Any

b. Increasing

c. Decreasing page 141 / google


d. Strong

320. . ________ is commonly the running time of Dijkstra's Algorithm using the
binary heap method.

a. Θ (E log V) page 156

• Θ (V log )

• Θ (log E)

• Θ (Blog V)

321. Which technique is used in the implementation of Kruskal solution for the MST?

a. Greedy Technique page 142 / google


b. Divide-and-Conquer Technique

c. Dynamic Programming Technique

d. The algorithm combines more than one of the above techniques i.e. Divide-and-

Conquer and Dynamic Programming

322. A fully connected undirected graph of 5 nodes will have _______ edges.

 4
AL-JUNAID TECH INSTITUTE
 5

10 n(n-1)/2
d. 15

323. Prim's algorithm is based on_________ strategy.

a. Greedy page 150 / google

b. Dynamic programming

c. Divide and Conquer

d. Exponential

324. We say that two vertices u and v are mutually ______if u can reach v and vice
versa.
a. Crossed

b. Forward

c. Reachable page 135

d. Not Reachable
AL-JUNAID TECH INSTITUTE
325. In Dijkstra's algorithm, initially the estimated value from source vertex to any
vertex v is:

a. Zero (0)
b. One (1)

c. Minus one (-1)

d. Infinity (∞) page 154


326. A strongly connected component only apply to:

a. Directed Graph page 135 / google

• Undirected Graph

• Minimum Spanning Tree

• Breadth First Search

327. A graph may contain_______

 Exactly one MST

 No MST

 One or zero MST

 More than one MST google

328. In ______ algorithm(s), at any time, the subset of edges A forms a single tree.

a. Kruskals

b. Prim's page 149

c. kruskal's and Prim's

d. BFS

329. The _______given by DFS allow us to determine a number of things about a


graph or
AL-JUNAID TECH INSTITUTE
Digraph
a. color stamps

b. time stamps page 130


c. line stamps

d. node stamps

330. . In Kruskal's algorithm, the vertices will be stored in________.

a. Links

b. Sets page 147

• nodes

• Loops

331. Keeping in mind the shortest path, if given scenarios occur in computer networks
like the internet where data packets have to be routed. The vertices are _______. Edges
are

______which may be wired or wireless.

a. Routers, communication links page 153

• Internet, routers

• Communication links, routers

• Routers, internet
AL-JUNAID TECH INSTITUTE
332. In computing the strongly connected components of a digraph. vertices of the
digraph

are ________into subsets


a. Joined

b. Partitioned page 135


c. Deleted
d. Created

333. In undirected graph, by convention all the edges are called _______edges.

a. Forward

b. Back page 130

c. Cross

d. Both forward and back

334. In Timestamped DFS, No back edges means_______

a. 1 cycle

b. no cycles page 131

c. DFS

d. BFS

335. . In Prim's algorithm, we start with the ______vertex r, it can be any vertex.

• Pivot

• Leaf

• negative

d. Root page 149


AL-JUNAID TECH INSTITUTE
336. . The ancestor and descendent relation can be nicely inferred by the______ lemma.

a. addition

b. division

c. parenthesis page 129


d. Node

337. Which of the following statement is true?

• Kruskal algorithm is multiple source technique for finding MST.

• Kruskal's algorithm is used to find minimum spanning tree of a graph, time complexity
of this algorithm is 0(EV)

• Both I and II

• Kruskal’s algorithm (choose best non-cycle edge) is better than Prim's (choose
best Tree edge) when the graph has relatively few edges.

See option B of Sr 46

338. . The time complexity to compute Graph transposes G^T is (V+E), if you have __
for G.

a. an adjacency list page 138

• Array list

• complete list

• stack
AL-JUNAID TECH INSTITUTE
339. . In Prim's algorithm, If there is no edge from u to a vertex in S. we set the
key value to_____

• 0

• 1

• -1

d. ∞ page 151

340. . What is the time complexity to extract a vertex from the priority queue in
Prim's algorithm?

• O(log E)

• O(V)

• O(V+E)

d. O(logV) page 152

341. . Edge weights can be interpreted as distance _____

• in breadth-First Search

• in Queue's

c. in the shortest-paths page 153


d. in depth-First Search

342. The ________ given by DFS allow us to determine whether the graph contains
any

cycles.

a. Order

b. Time stamps page 130

c. BFS traversing

d. Topological sort
AL-JUNAID TECH INSTITUTE
343. . Dijkstra's algorithm works on a weighted directed graph G(V, E) in which all
weights

______ are non-negative.

a. Vertices

b. Edges page 154

• nodes

• links

344. . By breaking any edge on a cycle created in free tree, the free_____ is restored.

a. Edge

b. Tree page 142

c. Cycle

d. Vertex

345. . Bellman-Ford algorithm is used to solve ______ problems.

a. All pair shortest path

b. Single source shortest path google

c. Flow of networking

d. Double source shortest path


AL-JUNAID TECH INSTITUTE
346. . From the given options which one is correct regarding the time complexity of
Dijkstra's algorithm

• O(N)

• O(N^3)

• O(N^2)

d. O(log N) google

347. . In which algorithm, information of shortest path is propagated sequentially along


each

shortest path in the graph.

a. Bellman-Ford page 16

52) Brute-force technique

53) Dijkstra's

54) Prim's

348. In Timestamped DFS-cycles lemma, if edge (u, v) is a tree, forward or cross edge,
then a. f[u] < f[v]

b. f[u] > f[v] page 130

52) f[u] ≤ f[v]

53) f[u] ≥ f[v]

349. Bellman-Ford Algorithm does not allow G(graph) to have _____________

a. positive cost cycles

b. negative cost cycles page 159

c. negative weights edges

d. positive weights edges

350. Kruskal algorithm (choose best non cycle edge) is better than Prims (choose
best tree edge) when the _______has relatively few______
AL-JUNAID TECH INSTITUTE
a. tree, edges

b. graph edges see option D of Sr 23

• tree, branches

• graph, branches

351. Finding the faster result of the shortest path from u to v for every pair of
vertices and we use ____

a. Single-pair shortest-paths problem

b. Two pair shortest the problem

c. All pair shortest paths problem page 153


d. both I and II
352. There are no________ edges in
undirected graph.
a. Forward

b. Back

c. Cross page 130

d. Both forward and back


AL-JUNAID TECH INSTITUTE
353. Networks are ______ in the sense that it is possible from any location in the
network to

reach any other location in the digraph

a. Complete page 135

b. Incomplete

c. Not graphs

d. Transportation

354. . Dijkstra's algorithm:

a. Has greedy approach to find all shortest paths

b. Has both greedy and Dynamic approach to find all shortest paths

c. Has greedy approach to compute single source shortest paths to all other

vertices page 154

e. Has both greedy and dynamic approach to compute single source shortest paths to all
other vertices

355. Bellman-Ford algorithm is slower than

a. Brute-force technique

b. Dijkstra's page 159

58) Prim's

59) Graph Algorithm

356. Dijkstra's Algorithm cannot


be applied on

a. directed and weighted graphs

b. graphs having negative weight function google

• unweighted graphs
AL-JUNAID TECH INSTITUTE
• undirected and unweighted graphs

357. . Which of the following is used in the data structure for implementing
Dijkstra's Algorithm?

a. Max heap

b. Stack's

c. Circular queue

d. Priority queue Google

358. . In Generic approach determining of Greedy MST, we maintain a subset A of


____

a. Edges page 143

• Vertices

• Cycles

• Paths

359. In Dijkstra's algorithm the estimated value of source vertex d[s] is

a. Equal to 0 page 154

• Equal to 1

• Greater than 0

• Greater than 1
AL-JUNAID TECH INSTITUTE
360. Dijkstra's algorithm is a simple________ algorithm for computing the single-
source

shortest-paths to all other vertices.

a. Greedy page 154

c. Bellman-Ford

d. Divide and conquer

e. Brute-Force

361. In Timestamped DFS. If there is a back edge (u, v) then v is an ancestor of u


and by following tree edge from v to u, we get ____________.

a. Nothing

b. a cycle page 131

c. a line

d. a graph

362. There exists a unique path between any _______ vertices of a free tree.

a. One

b. Two page 142

• Three

• Four

363. ______________ technique is look like propagating wave-front outward.

a. Generic traversal

b. Breadth first traversal page 117

c. Depth first traversal


AL-JUNAID TECH INSTITUTE
d. Time stamp traversal

364. You have an adjacency list for G, what is the time complexity to compute
Graph transpose G^T?

a. (V+E) page 138

• V.E

• V

• E

365. In the shortest-paths problem, we are given a weighted of ______G =(V, E).

a. Directed graph page 153

65) Line graph

66) Un-directed graph

67) Weighted graph

366. Equivalence relation partitions the vertices into _______ classes of mutually
reachable

vertices and these are the strong components

a. Variance

b. Equivalence page 136

c. Non equivalence

d. Non classes
AL-JUNAID TECH INSTITUTE
367. Overall Running time of Prim's algorithm is _________.

a. Θ(ElogE)

b. Θ(ElogV)

c. Θ((V+E)logV) page 152


d. Θ((V+E)logE)

368. For ________ graphs, there is no distinction between forward and back edges.

a. large

b. directed

c. undirected page 130


d. Medium

369. For ________ graphs, there is no distinction between forward and back edges.

a. Undirected page 130

• directed

• small

• large

370. As the Kruskal's algorithm runs, the edges in viable set A induce a ________ on
the

vertices.

a. Set

b. Graph

c. Tree

d. Forest page 147

371. In strong components algorithm, the form of graph is used in which all the
_______ of

original graph G have been reversed in direction.


AL-JUNAID TECH INSTITUTE
a. Vertices

b. Edges page 138

c. Both edges & vertices

d. Trees

372. In computing the ________ components of a digraph, vertices of the digraph are

partitioned into subsets.


a. weakly connected

b. strongly connected page 135


c. Best
d. Worst

373. Timestamp structure of ________ is used in determining the strong components


of a

digraph.

a. DFS google

b. BFS

c. Both DFS & BFS

d. MST
AL-JUNAID TECH INSTITUTE
374. In Prim's algorithm, if the color of a vertex is _______ then it is in S otherwise
not.

a. White

b. Gray

c. Black page 151


d. Blue

375. Digraphs _________ in communication and transportation networks.

a. are not used

b. are used page 135

c. parts are used

d. final value is used

376. Once you enter a strong component, every vertex in the component is
________.

a. not reachable

b. reachable page 137

c. reachable some times

d. removed

377. In Kruskal’s algorithm, the next edge is added to viable set A, if its adding
does not induce a/an __________.

a. Vertex

b. Edge

c. Cycle page 147


d. Tree
AL-JUNAID TECH INSTITUTE
378. Problems such as the shortest route between cities can be solved
efficiently by modelling the road map as a _________.

a. Tree

b. Graph page 153

c. Linked list

d. Stack

379. In Bellman-Ford Algorithm, relaxation applies to every edge of the graph and
repeat this ______ time.

a. E – 1

b. E + 1

c. V + 1

d. V – 1 page 159

380. A topological sort of a DAG is a ________ ordering of the vertices of the DAG
such

that for each edge (u, v), u appears before v in the ordering.

a. Linear page 134

b. Parallel

c. Sequence

d. Non-linear
AL-JUNAID TECH INSTITUTE
381. Adding any edge to a free tree creates a unique ______

a. Vertex

b. Edge

c. Cycle page 142

d. Strong component

382. Back edge is:

a. (u, v) where v is an ancestor of u in the tree. Page 128

b. (u, v) where u is an ancestor of v in the tree.

c. (u, v) where v is a predecessor of u in the tree.

d. (u, v) where u is a mid of v in the tree.

383. In Kruskal's algorithm, the next _______is not added to viable set A, if its adding

induce a/an cycle.


a. Vertex

b. Edge page 147


c. Cycle
d. Tree

384. Which of the following statement is false about Dijkstra'sAlgorithm?

a. It can be applied on graphs having a negative weight function google

b. It is used to solve Single-source shortest path

c. It works on a weighted directed graph

d. Its implementation in data structure is possible through the priority queue

385. . In strong components algorithm, first of all DFS is run for getting _______
times of

vertices.
AL-JUNAID TECH INSTITUTE
a. Start page 138
b. Finish
c. Both start & finish

d. Middle

386. . The tricky part of _______ algorithm(s) is/are, how to detect whether the addition
of an

edge will create a cycle in viable set A.

a. Kruskal’s page 149


b. Prim’s
c. Both Kruskal’s and Prim’s
d. DFS

387. . _________ components are not affected by reversal of all edges in terms of
vertices

reachability.

a. Strongly connected page 139


b. Weakly connected
c. First two
d. Last two
AL-JUNAID TECH INSTITUTE
388. In Prim's algorithm, we will make use of _________.

a. Stack

b. Priority Queue page 150

c. Array

d. List

389. The component digraph is necessarily ________.

a. straight

b. cyclic

c. Acyclic page 136


d. Strong

390. A free tree with n _________ have exactly n - 1 ________.

a. vertices, nodes

b. edges, vertices

c. nodes, vertices

d. vertices, edges page 142

391. If you find yourself in maze the better traversal approach will be:

a. BFS google (always return with short part)

c. Level order
d. DFS
392. Forward
edge is :

a. (u, v) where u is proper descendent of v in the tree

b. (u, v) where v is proper descendent of u in the tree page 129


AL-JUNAID TECH INSTITUTE
c. (u, v) where v is proper ancestor of u in the tree

d. (u, v) where u is proper ancestor of v in the tree

393. . cross edge is :

a. (u, v) where u and v are not ancestor of one another

b. (u, v) where u is ancestor of v and v is not descendent of u

c. (u, v) where u and v are not ancestor or descendent of one another page 129

d. (u, v) where u and v are either ancestor of descendent of one another


394. . The running time of Bellman-Ford algorithm is _________.

a. Θ(V + E)

b. Θ(E + E)

c. Θ(VE) page 159


d. Θ(V + V)

395. In Bellman-Ford Algorithm, relaxation applies to ________ of the graph.

a. Every edge page 159

b. Every Vertices

c. Only First Vertices

d. Only First edge

396. If a subset of edges A is visible for building MST, it cannot contain a/an____

a. Vertex

b. Edge

c. Cycle page 143


d. Graph

397. . In Timestamped DFS-cycles lemma, if edge (u, v) is a back edge, then


_________.

a. f[u] <f[v]
AL-JUNAID TECH INSTITUTE
b. f[u] > f[v]

c. f[u] ≤ f[v] page 130


d. f[u] ≥ f[v]

398. In digraph G=(V,E) ;G has cycle


if and only if

a. The DFS forest has forward edge.

b. The DFS forest has back edge page 131

c. The DFS forest has both back and forward edge

d. BFS forest has forward edge

399. . The key[u] is the weight of the ________ going from u to any vertex in S.

a. lightest edge page 151

b. edge

c. lighter edge

d. heavier edge

400. In Bellman-Ford Algorithm, path consists of at most _______ edges.


a. V + 1

b. V-1 page 160

c. E + 1
d. E-1

401. According to parenthesis lemma, vertex u is a descendent of v vertex it and only if;

a. [d[u], f[u]] ⊆ [d[v], f[v]] page 129


b. [d[u], f[u]] ⊇ [d[v], f[v]]

c. Unrelated

d. Disjoint
AL-JUNAID INSTITUTE GROUP
402. Edge weights can be interpreted as distance ________.

a. in breadth-First Search

b. in Queue's

c. in the shortest-paths page 153

d. in depth-First Search

403. __________ algorithm allows negative weights edges and no negative cost
cycles.

a. Brute-force technique

b. Bellman-Ford page 159

c. Dijkstra’s

d. Print

404. In Huffman encoding, the characters with smallest probabilities are placed at
the------------depth of the tree.

a. Minimum

b. Average

• Maximum page 102

• Root

405. There are -------------- ways to representing graphs.


• 3

• 1

• 2 page 116

a. 4
406. Each time we traverse graph by Breadth-first search algorithm, we count the
distance from----------.
AL-JUNAID INSTITUTE GROUP
a. Starting node

• Neighbours of the starting node page 117

• Right most node

• Left most node

407. In Activity Selection problem, intuitively--------------.

• There are always short activities as input

• Short activities are not attractive

• Duration of the activities does not matter

• We do not like long activities page105


408. The activity scheduling is a simple scheduling problem for which the greedy
algorithm approach provides a/an------------solution.

a. Simple

b. Sub-optimal

• Optimal page 105

c. Non optimal

409. The ------------- is a problem for which the greedy algorithm approach provides
an optimal solution.

• Activity selection page 105

• Dynamic programming

• Knapsack problem

• NP complete problem
410. Which of the following ways can be used to represent a graph?

a. Adjacency list
AL-JUNAID INSTITUTE GROUP
b. Incidence matrix

• Adjacency list , Adjacency Matrix page 116

• No way to represent

411.
Queue Data Structure work on ------------- principles.
4
• FIFO(first in first out) cs301

• LIFO(last in first out)

• JLO(just in last out)

• LOFI(last out first in)

412. Graphs can be represented by an--------------- and -----------------.

• queue , stack

• adjacency list , adjacency matrix page 116

a. adjacency right , adjacency left

b. Binary , linear
413. Identify a TRUE statement about Knapsack.

a. The Knapsack Problem does not belongs to the domain of optimization


problems

• The Knapsack Problem belongs to the domain of optimization problems page


91

i. The Knapsack Problem cannot be solved by using


Dynamic programming
• The Knapsack Problem is optimally solved by using Brute force algorithm
AL-JUNAID INSTITUTE GROUP
414. Which of the following is true about graph?

a. A graph may contain no edges and many vertices

• A graph may contain many edges and no vertices

415. Which type of algorithm is harder to prove the correctness?

• Greedygoogle
• Brute force

• Dynamic programming

• Divide and Conquer

416. The running time of brute-force algorithm to solve Knapsack problem is------

• O(h1)

• O(n3)

• O (n!)

• O(2^n) pg#92

417. If a matrix has three rows and two columns, the dimension of matrix will be:

• 3x2 Conceptual

• 2x3

• 3x3

• 2x2
AL-JUNAID INSTITUTE GROUP
418. The Probability in Huffman encoding is the number of occurrences of a
character divided by the total-

-------------in the message.

c. Numbers

d. Frequencies

e. Strings

f. Characters pg#100

419. In recursive formulation


of Knapsack Problem: V
[0, j] = ------------- for
j>=0

• -1

• 0 pg#93

• 1

• 2
420. The Knapsack Problem belongs to the domain of-----------problem.

g. Optimization pg#91

h. Sorting
i. Linear solution

j. Searching

421. An optimization problem is one in which you want to find the-----------solution.

k. Simple

l. Good

m. Best pg#97
AL-JUNAID INSTITUTE GROUP
• Worst

422. Huffman algorithm generates an co


optimum------------ de.

• Prefix page 102

• Postfix

• Infix

• None of the above

423. Which of the following algorithms solves the Fractional Knapsack Problem
more effectively?

• Divide and Conquer

• Greedy algorithm page 109

• Dynamic programming

• Backtracking

424. One of the limitation in 0/1 Knapsack is that an item can either be----------in the
bag or not.

 Use

• Put page 91

• Move
 Store

425. In Dynamic Programming based solution of Knapsack Problem, if we decide to


take an object’i’ then we gain-------------.
AL-JUNAID INSTITUTE GROUP
a. W(Total weight of Knapsack)

b. V(Total value of all items)

• vi(value of object i) page 93


• None of the given option

426. An activity scheduling algorithm, the width of a rectangle--------------.

n. Is always ignored

o. Direct toward recursion

p. Should be maximized

• Indicates the duration of an activity page 106


427. The prefix code generated by Huffman algorithm-------------- the expected
length of the encoded string.

• Minimizes page 102

 Balances

 Maximizes

 Keeps constant

428. An optimization problem is one in which you want to find,


► Not a solution
► An algorithm
► Good solution
► The best solution (Page 97)
429. Although it requires more complicated data structures, Prim's algorithm for a
minimum spanning tree is better than Kruskal's when the graph has a large
number of vertices.
► True
► False
430. If a problem is in NP, it must also be in P.
► True
► False
AL-JUNAID INSTITUTE GROUP
► unknown (Page 173)
431. What is generally true of Adjacency List and Adjacency Matrix
representations of graphs?
► Lists require less space than matrices but take longer to find the weight of an
edge (v1,v2)
► Lists require less space than matrices and they are faster to find the weight
of an edge (v1,v2)
► Lists require more space than matrices and they take longer to find the
weight of an edge (v1,v2)
► Lists require more space than matrices but are faster to find the weight of an
edge (v1,v2)
432. If a graph has v vertices and e edges then to obtain a spanning tree we have to
delete
► v edges.
► v – e + 5 edges
► v + e edges.
► None of these
433. Maximum number of vertices in a Directed Graph may be |V2 |
► True
► False
434. The Huffman algorithm finds a (n) _____________ solution.
► Optimal
► Non-optimal
► Exponential
► Polynomial
435. The Huffman algorithm finds an exponential solution
► True
► False
436. The greedy part of the Huffman encoding algorithm is to first find two nodes
with larger frequency.
► True
► False (Page 100)
437. one The codeword assigned to characters by the Huffman algorithm have the
property that no codeword is the postfix of any other.
► True (Page 101)
► False
438. Huffman algorithm uses a greedy approach to generate a postfix code T that
minimizes the expected length B (T) of the encoded string.
► True
► False (Page 102)
AL-JUNAID INSTITUTE GROUP
439. Shortest path problems can be solved efficiently by modeling the road map as a
graph.
► True (Page 153)
► False
440. Dijkestra’s single source shortest path algorithm works if all edges weights are
non-negative and there are negative cost cycles.
► True
► False (Page 159)
441. Bellman-Ford allows negative weights edges and negative cost cycles.
► True
► False (Page 159)
442. The term “coloring” came form the original application which was in
architectural design.
► True
► False (Page 176)
443. In the clique cover problem, for two vertices to be in the same group, they must
be adjacent to each other.
► True (Page 176)
► False
444. Dijkstra’s algorithm is operates by maintaining a subset of vertices
► True (Page 155)
► False
445. The difference between Prim’s algorithm and Dijkstra’s algorithm is that
Dijkstra’s algorithm uses a different key.
►True ( Page 156)
► False
446. We do sorting to,
► keep elements in random positions
► keep the algorithm run in linear order
► keep the algorithm run in (log n) order
► keep elements in increasing or decreasing order (Page 40)
447. After partitioning array in Quick sort, pivot is placed in a position such that
► Values smaller than pivot are on left and larger than pivot are on right
(Page 48) ► Values larger than pivot are on left and smaller than pivot are on
right
► Pivot is the first element of array
► Pivot is the last element of array
448. Merge sort is stable sort, but not an in-place algorithm
► True (Page 54)
► False
AL-JUNAID INSTITUTE GROUP
449. In counting sort, once we know the ranks, we simply _________ numbers to
their final positions in an output array.
► Delete
► copy (Page 57)
► Mark
► arrange
450. one Dynamic programming algorithms need to store the results of intermediate
sub-problems.
► True (Page 75)
► False
451. A p × q matrix A can be multiplied with a q × r matrix B. The result will be a p
× r matrix C. There are (p . r) total entries in C and each takes _________ to
compute.
► O (q) (Page 84)
► O (1)
► O (n 2 )
► O (n3 ) –
452. _______________ is a graphical representation of an algorithm
►  notation
►  notation
► Flowchart
► Asymptotic notation
453. one Which of the following is calculated with big o notation?
 ►Lower bounds
 ►Upper bounds (Page 25)
 ►Both upper and lower bound
 ►Medium bounds
454. Merge sort makes two recursive calls. Which statement is true after these
recursive calls finish, but before the merge step?
 ►The array elements form a heap
 ►Elements in each half of the array are sorted amongst themselves
 ►Elements in the first half of the array are less than or equal to elements in
the second half of the array
 ►None of the above 7
455. Who invented Quick sort procedure?
 ►Hoare
 ►Sedgewick
 ►Mellroy
 ►Coreman
456. What is the solution to the recurrence T(n) = T(n/2)+n, T(1) = 1
AL-JUNAID INSTITUTE GROUP
 ►O(logn)
 ►O(n) (Page 37)
 ►O(nlogn)
 ►O(2n)
457. one Consider the following Huffman Tree The binary code for the string TEA
is
 ►10 00 010
 ►011 00 010
 ►10 00 110
 ►11 10 110
458. A greedy algorithm does not work in phases.
►True
►False (Page 97)
459. Can an adjacency matrix for a directed graph ever not be square in shape?
 ►Yes
 ►No
460. One of the clever aspects of heaps is that they can be stored in arrays without
using any____________.
 ►Pointers (Page 40)
►constants
 ►variables
 ►functions
461. Merge sort requires extra array storage, 
►True (Page 54) 
►False
462. Non-optimal or greedy algorithm for money change takes____________
 ►O(k) (Page 99)
 ►O(kN)
 ►O(2k)
 ►O(N)
463. The Huffman codes provide a method of encoding data inefficiently when
coded using ASCII standard.
 ►True
 ►False (Page 99)
464. Using ASCII standard the string abacdaacac will be encoded with __________
bits.
 ►80 (Page 99)
 ►160
 ►320
AL-JUNAID INSTITUTE GROUP
 ►100
465. Using ASCII standard the string abacdaacac will be encoded with 160 bits.
 ►True
 ►False (Page 99)
466. one Using ASCII standard the string abacdaacac will be encoded with 320 bits.
 ►True
 ►False (Page 99)
467. Using ASCII standard the string abacdaacac will be encoded with 100 bits.
 ►True
 ►False (Page 99)
468. Using ASCII standard the string abacdaacac will be encoded with 32 bytes
 ►True
 ►False (Page 99)
469. The greedy part of the Huffman encoding algorithm is to first find two nodes
with smallest frequency.
 ►True (Page 100)
 ►False
470. The greedy part of the Huffman encoding algorithm is to first find two nodes
with character frequency
 ►True
 ►False (Page 100)
471. Huffman algorithm uses a greedy approach to generate an antefix code T that
minimizes the expected length B (T) of the encoded string.
 ►True
 ►False (Page 102)
472. Depth first search is shortest path algorithm that works on un-weighted graphs.
 ►True
►False (Page 153)
473. one Dijkestra s single source shortest path algorithm works if all edges weights
are non negative and there are no negative cost cycles.
 ►True (Page 159)
 ►False
474. Dijkestra s single source shortest path algorithm works if all edges weights are
negative and there are no negative cost cycles.
 ►True 
►False (Page 159
475. Floyd-Warshall algorithm is a dynamic programming algorithm; the genius of
the algorithm is in the clever recursive formulation of the shortest path
problem.
AL-JUNAID INSTITUTE GROUP
 ►True (Page 162)  ►Flase
476. Floyd-Warshall algorithm, as in the case with DP algorithms, we avoid
recursive evaluation by generating a table for
 ►k
 ► k ij d (Page 164)
 ►True
 ►Flase
477. The term coloring came from the original application which was in map
drawing.
 ►True (Page 176)
 ►False
478. In the clique cover problem, for two vertices to be in the same group, they must
be_______________each other.
 ►Apart from
 ►Far from
 ►Near to
 ►Adjacent to (Page 176)
479. Fixed-length codes may not be efficient from the perspective of _______the
total quantity of data. Select correct option:
►Minimizing (Page 99)
►Averaging
►Maximizing
►Summing
480. In greedy algorithm, at each phase, you take the________ you can get right
now, without regard for future consequences.
►Worst
►Minimum
►Good
►Best (Page 97)
481. one The difference between Prim s algorithm and Dijkstra s algorithm is that
Dijkstra s algorithm uses a same key.
 ►True
 ►False ( Page 156)
482. If a problem is in NP-complete, it must also be in NP.
► True (Page 178)
► False
483. If there are n items, there are _______ possible combinations of the items.
►2
►n
►2^n (Page 92)
AL-JUNAID INSTITUTE GROUP
►3^n
484. Using ASCII code, each character is represented by a fixed-length code word
of ________ bits per character.
►4
►6
►8 (P)age 99)
►10
485. In Knapsack Problem, the thief’s goal is to put items in the bag such that the
______ of the items does not exceed the limit of the bag.
►Value (Page 91)
►Weight
►Length
►Balance
486. one The knapsack problem does not belong to the domain of optimization
problems. ►True
►False (Page 91)
487. In Huffman encoding, for a given message string, the frequency of occurrence
(relative probability) of each character in the message is determined last.
►True
►False (Page 100)
488. Fixed-length codes are known for easy break up of a string into its individual
characters.
►True (Page 99)
►False
489. Question No: 8 ( Marks: 1 ) - Please choose one In ______ Knapsack Problem,
limitation is that an item can either be put in the bag or not-fractional items are
not allowed.
►0
►1
►0/1 (Page 91)
►Fractional
490. one The term “coloring” came from the original application which was in
architectural design.
► True
► False (Page173)
491. In Knapsack Problem, value and weight both are to be under consideration.
►True (page 91)
►False
492. Time complexity of DP based algorithm for computing the minimum cost of
chain matrix Multiplication is ________ .
AL-JUNAID INSTITUTE GROUP
►log n
►n
►n2
►n3 (Page 90)
493. Qestion No: 12 ( Marks: 1 ) - Please choose one In DP based solution of
knapsack problem, to compute entries of V we will imply a/an _______
approach.
►Subjective
►Inductive (Page 93)
►Brute force
►Combination
494. A greedy algorithm sometimes works well for optimization problems.
►True (Page 97)
►False
495. In Huffman encoding, frequency of each character can be determined by
parsing the message and __________ how many times each character (or
symbol) appears. ►Printing
►Incrementing
►Counting (Page 100)
►Deleting
496. Greedy algorithm can do very poorly for some problems.
►True (Page 97)
►False 14
497. one The Huffman codes provide a method of _________ data efficiently.
►Reading
►Encoding (Page 99)
►Decoding
►Printing
498. In _______ based solution of knapsack problem, we consider 2 cases, Leave
object Or Take object.
►Brute force
►Dynamic programming (Page 93)
499. Those problems in which Greedy finds good, but not always best is called a
greedy________.
►Algorithm
►Solution
►Heuristic (Page 97)
►Result
500. one In brute force based solution of knapsack problem, we consider 2 cases,
Leave object Or Take object.
AL-JUNAID INSTITUTE GROUP
►TRUE
►FALSE (Page 97)
501. ________ problem, we want to find the best solution.
►Minimization
►Averaging
►Optimization (Page 97)
►Maximization
502. Using ASCII standard the string abacdaacac will be encoded with 10 bytes.
 ►True (Page 101)
 ►False
503. In _______ algorithm, you hope that by choosing a local optimum at each step,
you will end up at a global optimum.
►Simple
►Non Greedy
►Greedy (Page 97)
►Brute force
504. one Huffman algorithm uses a greedy approach to generate an prefix code T
that minimizes the expected length B (T) of the encoded string.
 ►True (Page 102)
 ►False
505. Counting Money problem is an example which cannot be optimally solved by
greedy algorithm.
►True (Page 97)
►False
506. Huffman algorithm generates an optimum prefix code.
►True (Page 102)
►False
507. If the string “lmncde” is coded with ASCII code, the message length would be
_______ bits.
►24
►36
►48 (6*8=48)
►60
508. There are _________ nested loops in DP based algorithm for computing the
minimum cost of chain matrix multiplication.
►2
►3 (Page 90)
►4
►5
AL-JUNAID INSTITUTE GROUP
509. Inductive approach to compute entries of V is implied in _____ based solution
of knapsack problem.
►Brute force
►Dynamic programming (Page 93)
510. A number of lectures are to be given in a single lecture hall. Optimum
scheduling for this is an example of Activity selection.
►True (Page 105)
►False
511. The activity scheduling is a simple scheduling problem for which the greedy
algorithm approach provides a/an ________solution.
►Simple
►Sub optimal
►Optimal (Page 105)
►Non optimal
512. Question # 1 of 10 ( Marks: 1 ) Please choose one The string |xyz|, if coded
with ASCII code, the message length would be 24 bits.
►True
►False
513. An application problem is one in which you want to find, not just a solution,
but the ____ solution.
►Simple
►Good (Page 113)
►Best
►Worst
514. A dense undirected graph is:
► A graph in which E = O(V^2) click here 4 detail
►A graph in which E = O(V)
►A graph in which E = O(log V)
►All items above may be used to characterize a dense undirected graph
515. Suppose that a graph G = (V,E) is implemented using adjacency lists. What is
the complexity of a breadth-first traversal of G?
►O(|V |^2)
►O(|V | |E|)
►O(|V |^2|E|)
►O(|V | + |E|) pg 116
516. Which is true statement?
►Breadth first search is shortest path algorithm that works on un-weighted
graphs (Page 153)
►Depth first search is shortest path algorithm that works on un-weighted
graphs. ►Both of above are true.
AL-JUNAID INSTITUTE GROUP
►None of above are true.
517. one Forward edge is:
► (u, v) where u is a proper descendent of v in the tree.
► (u, v) where v is a proper descendent of u in the tree. (Page 129)
► (u, v) where v is a proper ancesstor of u in the tree.
► (u, v) where u is a proper ancesstor of v in the tree.
518. What general property of the list indicates that the graph has an isolated
vertex? ►There is Null pointer at the end of list.
►The Isolated vertex is not handled in list.
► Only one value is entered in the list.
►There is at least one null list.
519. one If you find yourself in maze the better traversal approach will be :
►BFS
►BFS and DFS both are valid
►Level order
►DFS
520. In digraph G=(V,E) ;G has cycle if and only if
►The DFS forest has forward edge.
►The DFS forest has back edge (Page 131)
►The DFS forest has both back and forward edge
►BFS forest has forward edge
521. Back edge is:
► (u, v) where v is an ancestor of u in the tree. (Page 128)
► (u,v) where u is an ancesstor of v in the tree.
► (u, v) where v is an predcessor of u in the tree.
►None of above
522. Which statement is true?
►If a dynamic-programming problem satisfies the optimal-substructure
property, then a locally optimal solution is globally optimal.
►If a greedy choice property satisfies the optimal-substructure property, then
a locally optimal solution is globally optimal.
► Both of above
►None of above
523. Cross edge is :
► (u, v) where u and v are not ancestor of one another
► (u, v) where u is ancesstor of v and v is not descendent of u.
► (u, v) where u and v are not ancestor or descendent of one another (Page
129)
► (u, v) where u and v are either ancestor or descendent of one another.
AL-JUNAID INSTITUTE GROUP
524. Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose
best tree edge) when the graph has relatively few edges.
►True click here 4 detail
►False
525. Which is true statement in the following?
►Kruskal algorithm is multiple source technique for finding MST. click here
for detail ►Kruskal’s algorithm is used to find minimum spanning tree of a
graph, time complexity of this algorithm is O(EV)
►Both of above
►Kruskal's algorithm (choose best non-cycle edge) is better than Prim's
(choose best Tree edge) when the graph has relatively few edges. click here 4
detail
526. Kruskal's algorithm (choose best non-cycle edge) is better than Prim's (choose
best tree edge) when the graph has relatively few edges.
►True click here 4 detail
►False
527. What algorithm technique is used in the implementation of Kruskal solution for
the MST?
►Greedy Technique (Page 142)
►Divide-and-Conquer Technique
►Dynamic Programming Technique
►The algorithm combines more than one of the above techniques
528. What is the time complexity to extract a vertex from the priority queue in
Prim’s algorithm?
►O (log E)
► (V)
► (V+E)
►O (log V) (Page 152)
529. The relationship between number of back edges and number of cycles in DFS
is, ►Both are equal
►Back edges are half of cycles
►Back edges are one quarter of cycles
►There is no relationship between no. of edges and cycles (Page 131)
530. You have an adjacency list for G, what is the time complexity to compute
Graph transpose G^T.?
► (V + E) (Page 138)
► (V E)
► (V)
531. A digraph is strongly connected under what condition?
AL-JUNAID INSTITUTE GROUP
►A digraph is strongly connected if for every pair of vertices u, v e V, u can
reach v . ►A digraph is strongly connected if for every pair of vertices u, v e
V, u can reach v and vice versa. (Page 135)
►A digraph is strongly connected if for at least one pair of vertex u, v e V, u
can reach v and vice versa.
►A digraph is strongly connected if at least one third pair of vertices u, v e V,
u can reach v and vice versa.
532. In in-place sorting algorithm is one that uses arrays for storage :
►An additional array
►No additional array (Page 54)
►Both of above may be true according to algorithm
►More than 3 arrays of one dimension.
533. In stable sorting algorithm
►One array is uses
►In which duplicating elements are not handled.
►More then one arrays are required.
►Duplicating elements remain in same relative position after sorting. (Page
54)
534. Which sorting algorithm is faster :
►O(n^2)
►O(nlogn) (Page 46)
►O(n+k)
►O(n^3)
535. In Quick sort algorithm, constants hidden in T(n lg n) are
►Large
►Medium
►Not known
►Small
536. Quick sort is based on divide and conquer paradigm; we divide the problem on
base of pivot element and:
►There is explicit combine process as well to conquer the solution.
►No work is needed to combine the sub-arrays, the array is already sorted
►Merging the sub arrays
►None of above. (Page 51
537. Dijkstra’s algorithm :
►Has greedy approach to find all shortest paths
►Has both greedy and Dynamic approach to find all shortest paths
►Has greedy approach to compute single source shortest paths to all other
vertices (Page 154)
AL-JUNAID INSTITUTE GROUP
►Has both greedy and dynamic approach to compute single source shortest
paths to all other vertices.
538. Which may be stable sort:
►Bubble sort
►Insertion sort
►Both of above (page 54)
►Selection sort
539. Question # 1 of 10 ( Marks: 1 ) Please choose one In the analysis of Selection
algorithm, we eliminate a constant fraction of the array with each phase; we get
the convergent _______________ series in the analysis,
►linear
►arithmetic
►geometric (page 37)
►exponent
540. How much time merge sort takes for an array of numbers?
►T(n^2)
►T(n) (Page 40)
►T( log n)
►T(n log n)
541. Counting sort has time complexity:
►O(n) ►O(n+k)
►O(k)
►O(nlogn)
542. The analysis of Selection algorithm shows the total running time is indeed
________in no
►arithmetic
►geometric
►linear (Page 37)
►orthogonal
543. Sorting is one of the few problems where provable ________ bonds exits on
how fast we can sort,
►upper
►lower (Page 39)
►average
►log n
544. In the analysis of Selection algorithm, we make a number of passes, in fact it
could be as many as
►T(n)
►T(n / 2)
►log n (Page 37)
AL-JUNAID INSTITUTE GROUP
►n / 2 + n / 4
545. number of nodes in a complete binary tree of height h is
►2^(h+1) – 1 (Page 40)
►2 * (h+1) – 1
►2 * (h+1)
► ((h+1) ^ 2) – 1 25
546. How many elements do we eliminate in each time for the Analysis of Selection
algorithm?
►n / 2 elements (Page 37)
► (n / 2) + n elements
►n / 4 elements
►2 n elements
547. Slow sorting algorithms run in,
►T(n^2) (Page 39)
►T(n)
►T( log n)
►T(n log n)
548. Counting sort is suitable to sort the elements in range 1 to k:
►K is large
►K is small (Page 57)
►K may be large or small
►None
549. Heaps can be stored in arrays without using any pointers; this is due to the
____________ nature of the binary tree,
►left-complete (Page 40)
►right-complete
►tree nodes
►tree leaves
550. Sieve Technique can be applied to selection problem?
►True (Page 35)
►False
551. A heap is a left-complete binary tree that conforms to the ___________
►increasing order only
►decreasing order only
►heap order (Page 40)
► (log n) order
552. Divide-and-conquer as breaking the problem into a small number of
►pivot
►Sieve
►smaller sub problems (Page 34)
AL-JUNAID INSTITUTE GROUP
►Selection
553. In Sieve Technique we do not know which item is of interest
►True (Page 34)
►False
554. The recurrence relation of Tower of Hanoi is given below T(n)={1 if n=1 and
2T(n-1) if n >1 In order to move a tower of 5 rings from one peg to another,
how many ring moves are required?
►16
►10
►32
►31 Click here 4 detail
555. one For the heap sort, access to nodes involves simple _______________
operations.
►arithmetic (Page 41)
►binary
►algebraic
►logarithmic
556. For the sieve technique we solve the problem,
►recursively (Page 34)
►mathematically
►precisely
►accurately
557. The sieve technique works in ___________ as follows
►phases (Page 34)
►numbers
►integers
►routines
558. A (an) _________ is a left-complete binary tree that conforms to the heap order
►heap (Page 40)
►binary tree
►binary search tree
►array
559. The sieve technique is a special case, where the number of sub problems is just
►5
►many
►1 (Page 34)
►few
560. Analysis of Selection algorithm ends up with,
►T(n)
►T(1 / 1 + n)
AL-JUNAID INSTITUTE GROUP
►T(n / 2)
►T((n / 2) + n) (Page 37)
561. For the heap sort we store the tree nodes in
►level-order traversal (Page 40)
►in-order traversal
►pre-order traversal
►post-order traversal
562. The reason for introducing Sieve Technique algorithm is that it illustrates a
very important special case of,
►divide-and-conquer (Page 34)
►decrease and conquer
►greedy nature
►2-dimension Maxima
563. Theta asymptotic notation for T (n) :
►Set of functions described by: c1g(n)Set of functions described by
c1g(n)>=f(n) for c1 s
►Theta for T(n)is actually upper and worst case comp
►Set of functions described by:
►c1g(n)
564. Sieve Technique applies to problems where we are interested in finding a
single item from a larger set of _____________
►n items (Page 34)
►phases
►pointers
►constant
565. Memorization is?
►To store previous results for future use
►To avoid this unnecessary repetitions by writing down the results of
recursive calls and looking them up again if we need them later (Page 47)
►To make the process accurate
►None of the above
566. Quick sort is
►Stable & in place
►Not stable but in place (Page 57)
►Stable but not in place
►Some time stable & some times in place
567. One example of in place but not stable algorithm is
►Merger Sort
►Quick Sort (Page 54)
►Continuation Sort
AL-JUNAID INSTITUTE GROUP
►Bubble Sort
568. Continuation sort is suitable to sort the elements in range 1 to k
►K is Large
►K is not known
►K may be small or large
►K is small (Page 57)
569. Which may be a stable sort?
►Merger
►Insertion
► Both above (Page 54)
►None of the above
570. An in place sorting algorithm is one that uses ___ arrays for storage
►Two dimensional arrays
►More than one array
►No Additional Array (Page 54)
►None of the above
571. Continuing sort has time complexity of ?
►O(n)
►O(n+k)
►O(nlogn)
►O(k)
572. single item from a larger set of _____________
►n items (Page 34)
►phases
►pointers
►vconstant
573. For the Sieve Technique we take time
►T(nk) ( Page 34)
►T(n / 3)
►n^2
►n/3
574. One Example of in place but not stable sort is
►Quick (Page 54)
►Heap
►Merge
►Bubble
575. Consider the following Algorithm: Factorial (n){ if (n=1) return 1 else return
(n * Factorial(n-1)) } Recurrence for the following algorithm is:
► T(n) = T(n-1) +1
► T(n) = nT(n-1) +1
AL-JUNAID INSTITUTE GROUP
► T(n)= T(n-1) +n
► T(n)=T(n(n-1)) +1
576. Due to left complete nature of binary tree, the heap can be stored in
► Arrays (Page 40)
► Structures
► Link Lis
►Stack
577. What type of instructions Random Access Machine (RAM) can execute?
►Algebraic and logic
►Geometric and arithmetic
►Arithmetic and logic (Page 10)
►Parallel and recursive
578. What is the total time to heapify?
► Ο(log n) (Page 43)
► Ο(n log n)
► Ο(n2 log n)
► Ο(log2 n)
579. word Algorithm comes from the name of the muslim author ____________
►Abu Ja’far Mohammad ibn Musa al-Khowarizmi.
580. al-Khwarizmi’s work was written in a book titled _______________
►al Kitab al-mukhatasar fi hisab al-jabr wa’l-muqabalah
581. Random access machine or RAM is a/an
► Machine build by Al-Khwarizmi
► Mechanical machine
► Electronics machine
► Mathematical model (Page 10)
582. A RAM is an idealized machine with ______________ random-access
memory.
► 256MB
► 512MB
► an infinitely large (Page 10)
► 100GB
583. What will be the total number of max comparisons if we run brute-force
maxima algorithm with n elements?
►2n
►2nn
► n (Page 14)
►8n
584. Due to left complete nature of binary tree, the heap can be stored in
► Arrays (Page 40)
AL-JUNAID INSTITUTE GROUP
► Structures
► Link Lis
►Stack
585. one What type of instructions Random Access Machine (RAM) can execute?
►Algebraic and logic
►Geometric and arithmetic
►Arithmetic and logic (Page 10)
►Parallel and recursive
586. What is the total time to heapify?
► Ο(log n) (Page 43)
► Ο(n log n)
► Ο(n2 log n)
► Ο(log2 n)
587. Random access machine or RAM is a/an
► Machine build by Al-Khwarizmi
► Mechanical machine
► Electronics machine
► Mathematical model (Page 10)
588. A RAM is an idealized machine with ______________ random-access
memory.
► 256MB
► 512MB
► an infinitely large (Page 10)
► 100GB
589. What will be the total number of max comparisons if we run brute-force
maxima algorithm with n elements?
►2n
►2nn
► n (Page 14)
►8n
590. The sieve technique works where we have to find _________ item(s) from a
large input.
►Single (Page 34)
►Two
►Three
►Similar
591. In which order we can sort?
►increasing order only
►decreasing order only
►increasing order or decreasing order (Page 39)
AL-JUNAID INSTITUTE GROUP
►both at the same time
592. For the heap sort we store the tree nodes in
►level-order traversal (Page 40)
►in-order traversal
►pre-order traversal
►post-order traversal
593. In the analysis of Selection algorithm, we eliminate a constant fraction of the
array with each phase; we get the convergent _______________ series in the
analysis, ►linear
►arithmetic
►geometric (Page 37)
►exponent
594. How much time merge sort takes for an array of numbers?
►T(n^2)
►T(n)
►T( log n)
►T(n log n) (Page 40)
595. Memoization is?
►To store previous results for future use
►To avoid this unnecessary repetitions by writing down the results of
recursive calls and looking them up again if we need them later (page 74)
►To make the process accurate
►None of the above
596. Cont sort is suitable to sort the elements in range 1 to k
►K is Large
►K is not known
►K may be small or large
►K is small (Page 57)
597. In place stable sorting algorithm.
►If duplicate elements remain in the same relative position after sorting (Page
54) ►One array is used
►More than one arrays are required
►Duplicating elements not handled
598. Sorting is one of the few problems where provable ________ bonds exits on
how fast we can sort, ►upper ►lower (Page 39) ►average ►log n
599. Question No: 65 ( Marks: 1 ) - Please choose one Counting sort has time
complexity: ►O(n) (Page 58)
►O(n+k)
►O(k)
►O(nlogn)
AL-JUNAID INSTITUTE GROUP
600. The running time of quick sort depends heavily on the selection of
►No of inputs
►Arrangement of elements in array
►Size o elements
►Pivot elements (Page 49)
601. Which may be stable sort:
►Bubble sort
►Insertion sort
►Both of above (Page 54)
602. In Quick Sort Constants hidden in T(n log n) are
►Large
►Medium
►Small
►Not Known
603. Quick sort is based on divide and conquer paradigm; we divide the problem on
base of pivot element and:
►There is explicit combine process as well to conquer the solution.
►No work is needed to combine the sub-arrays, the array is already sorted
►Merging the sub arrays
►None of above. (Page 51)
604. A point p in 2-dimensional space is usually given by its integer
coordinate(s)____________
► p.x only
► p.y only
► p.x & p.z
► p.x & p.y (Page 10)
605. In ____________ we have to find rank of an element from given input.
►Merge sort algorithm
►Selection problem (Page 34)
►Brute force technique
►Plane Sweep algorithm
606. In Heap Sort algorithm, if heap property is violated _________
►We call Build heap procedure
►We call Heapify procedure
►We ignore
►Heap property can never be violated
607. Upper bound requires that there exist positive constants c2 and n0 such that
f(n) ____ c2n for all n <= n0(ye question ghalat lag raha hai mujhae
►Less than
►Equal to or Less than (Page 25)
AL-JUNAID INSTITUTE GROUP
►Equal or Greater than
►Greater than
608. A RAM is an idealized algorithm with takes an infinitely large random-access
memory. ►True
►False (Page 10)
609. _________ is one of the few problems, where provable lower bounds exist on
how fast we can sort.
►Searching
►Sorting
►Both Searching & Sorting
►Graphing
610. Floor and ceiling are ____________ to calculate while analyzing algorithms.
►Very easy
►Usually considered difficult (Page 31)
611. In Heap Sort algorithm, the maximum levels an element can move upward is
_________
►Theta (log n) (Page 43)
►Order (log n)
►Omega (log n)
►O (1) i.e. Constant time
612. A point p in 2-dimensional space is usually given by its integer
coordinate(s)____________
►p.x only p.y
►only p.x & p.z
► p.x & p.y (Page 17)
613. In Heap Sort algorithm, the total running time for Heapify procedure is
____________
► Theta (log n) (Page 43)
►Order (log n)
►Omega (log n)
►O (1) i.e. Constant time
614. Algorithm is a mathematical entity, which is independent of a specific
machine and operating system.
►True
►False (Page 7)
615. While Sorting, the ordered domain means for any two input elements x and y
_________ satisfies only.
►x < y
►x > y
►x = y
AL-JUNAID INSTITUTE GROUP
►All of the above (Page 39)
616. Quick sort is best from the perspective of Locality of reference.
►True (Page 9)
►False
617. In Heap Sort algorithm, we build _______ for ascending sort.
►Max heap (Page 41)
►Min heap
618. In Sieve Technique, we know the item of interest.
►True
►False (Page 34)
619. While solving Selection problem, in Sieve technique we partition input data
__________
►In increasing order
►In decreasing order
►According to Pivot (Page 35)
►Randomly
620. In pseudo code, the level of details depends on intended audience of the
algorithm.
►True (Page 12)
►False
621. If the indices passed to merge sort algorithm are ________,then this means that
there is only one element to sort. ►Small
►Large
►Equal (Page 28)
►Not Equal

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy