0% found this document useful (0 votes)
84 views45 pages

CS502 MidTerm MCQs by Talha Sajid

Uploaded by

Talha Sajid
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
0% found this document useful (0 votes)
84 views45 pages

CS502 MidTerm MCQs by Talha Sajid

Uploaded by

Talha Sajid
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/ 45

Mid-Term CS502(Fundamentals of Algorithms) Page 1 of 45

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 2 of 45

1.. Heap sort is a/an _______ and ________ sorting algorithm.


A. Not in-place, not stable one
B. In-place, not stable one
C. Not in-place, stable one
D. In-place, stable one

2. The sequence of merge sort algorithm is:


a) Divide Combine-Conquer
b) Conquer-Divide-Combine
c) Divide-Conquer-Combine
d) Combine-Divide-Conquer

3. 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
d) Fractional

4. In Heap Sort algorithm (using max heap), when every time


maximum elements removed from top ________.
a) We call merge Sort Algorithm
b) it becomes Order n2 Algorithm
c) Divide and Conquer strategy helps us

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 3 of 45

d) We are left with a hole

5. In Bucket sort, if there are duplicates then each bin can be replaced by a __________.
a) Hash table
b) Heap
c) Stack
d) Linked list

6. If there are duplicates in __________ sort, then each bin can be


replaced by a linked list.
a) Heap
b) Merge
c) Bucket
d) Quick

7. The average case running time of quick sort algorithm is theta _________.
a) n x n log(n)
b) Log(n)
c) nlog(n)
d) (n)

8. Quick sort algorithm required a lot of comparisons in the ____________ condition.


a) Worst case
b) Best and Average case
c) Average case
d) Best case

9. Memorization is a part of ________ programming strategy.


a) dynamic

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 4 of 45

b) fast
c) memory
d) slow

10. ____________ programming is essentially recursion without repetition.


a) array
b) Dynamic
c) N log n
d) Fast

11. The main shortcoming of counting sort is that it is useful for__________.


a) large integers
b) large real numbers
c) small real numbers
d) small integers

12. In max heap (for Heap Sort algorithm), when every time maximum element is removed
from top we replace it with _____ leaf in the tree.
a) second last
b) Last
c) First
d) Any

13. Quick sort algorithm was developed by -


a) AlferdAho
b) Sedgewick
c) John Vincent Atanasoff
d) Tony Hoare

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 5 of 45

14. 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.
a) 3x2
b) 2x3
c) 2x2
d) 3x3

15. In Sorting the key value or attribute_____ from an ordered domain.


a) Must be
b) Not always
c) May be
d) Occasionally

16. Floor and ceiling are ______ to calculate while analyzing


algorithms
a) Very easy
b) Usually considered difficult
c) 3rd Option is missing
d) 4th Option is missing

17. _____ of reference is an important fact of current processor technology.


a) Defining
b) Assigning
c) Formality
d) Locality

18. In average-case time analysis of Quick sort algorithm, the most balanced case for
partition is when we divide the list of elements into _.
a) Equal no. of pieces as of input elements
b) Single piece exactly

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 6 of 45

c) Two nearly equal pieces


d) Three nearly equal pieces

19. Which of the following is calculated with Big O notation?


a) Medium bounds
b) Upper bounds
c) Lower bounds
d) Both upper and lower bounds

20. Edit distance algorithm based on ________ strategy


a) Greedy
b) Dynamic Programming
c) Divide and Conquer
d) Searching

21. In Heapsort Algorithm, total time taken by heapify procedure is ________


a) (log n)
b) (log2 n)
c) (n log n)
d) (n2 log n)

22. Al-Khwarizmi was a/an _______


a) Artist
b) Mathematician
c) Astronomer
d) Khalifah

23. Pseudo code of algorithms are to be read by _______.


a) People

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 7 of 45

b) RAM
c) Computer
d) Compiler

24. When a recursive algorithm revisits the same problem over and over
again, we say that the optimization problem has ________ sub-problems.
a) Overlapping
b) Over costing
c) Optimized
d) Three

25. In order to say anything meaningful about our algorithms, it will be important for us to
settle on a ______.
a) Java Program
b) C++ Program
c) Pseudo program
d) Mathematical model of computation

26. Comparison-based sorting algorithms always takes ____________ time.


a) Theta nlog(n)
b) Omega n(n^2)
c) Big Oh nlog(n)
d) Omega nlog(n)

27. Quick sort does not require any additional array for storage except for
recursive function calls is called __________.
a) In-Place
b) Stable
c) Not In-Place
d) Unsorted

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 8 of 45

28. The total running time for Selection algorithm is ___________ in n.


a) Exponential
b) Geometric
c) Quadratic
d) Linear

29. What is the worst-case time of a quick sort which happens rarely?
a) O(log n)
b) O(n log n)
c) O(n2)
d) O(n)

30. A Principal operation for maintaining the heap property is called


heapify, it is also called:
a) Sifting Up
b) Sifting left
c) Sifting right
d) Sifting down

31. Sieve technique is a special case of ___________ strategy.


a) Greedy approach
b) Graph
c) Divide-and-Conquer
d) Dynamic programming

32. If input “n” is odd, then median will be _________


a) n/2
b) n+2

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 9 of 45

c) (n-1)/2
d) (n+1)/2

33. Quick sort is based on ____________ strategy.


a) Graph Theory
b) Greedy approach
c) Divide-and-Conquer
d) Dynamic programming

34. _________ is one of the few problems, where provable lower bounds exist on how fast
we can sort.
a) Sorting
b) Graphing
c) Searching
d) Both Searching & Sorting

35. Merge sort is based on _______.


a) Brute-force
b) Plan-sweep
c) Axis-sweep
d) Divide and Conquer

36. In Quick sort algorithm, the subarray ______________ has elements


which are less than pivot element x.
a) A[q]
b) A[p....r]
c) A[q+1....r]
d) A[p....q-1]

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 10 of 45

a) 37. What time does Merge Sort algorithm take in order to sort an
b) array of 'n' numbers?
a) (n)
b) (log n)
c) (n^2)
d) (n log n)

38. algorithm, the first step is to ___________.


a) Call Build-Heap procedure
b) Sort the array in descending order
c) Call Heapify procedure
d) Find the number of input elements

39. In ___________ sorting algorithm, we just need to swap positions of


data during the Partitioning function.
a) Merge sort
b) Counting sort
c) Radix sort
d) Quick sort

40. The definition of theta-notation relies on proving ________ asymptotic bound.


a) One
b) Lower
c) Upper
d) Both lower & upper

41. There are __________ entries in the Edit Distance Matrix.


a) ϴ (n)
a) ϴ (n2)
b) ϴ (n+2)

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 11 of 45

c) ϴ (n + 100)

42. . In merge sort algorithm, to merge two lists of size n/2 to a list of size n, takes
_______ time.
a) Theta (n)
b) Theta log(n)
c) Theta log2(n)
d) Theta n log(n)

43. For average-case time analysis of quick sort algorithm, pivot selection
is on average basis from _________.
a) All possible random values
b) Pivot is input separately
c) half of the input values
d) Values greater than 5

44. We can make _______ recursive calls in Fibonacci Sequence.


a) Infinite
b) Finite
c) Only one
d) Zero

35. As per algorithm of dynamic programing, we need to store the result(s)


of __________.
a) First sub-problem only
b) Best solution only
c) Intermediate sub-problems
d) Final solution only

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 12 of 45

45. . Following is NOT the application of Edit Distance problem.


a) Speech recognition
b) Spelling Correction
c) Ascending Sort
d) Computational Molecular Biology

46. In chain matrix multiplication, table is filled ______ to find the multiplication of matrix.
a) row wise
b) column wise
c) diagonally
d) bottom-to-up

47. . In plane sweep approach, a vertical line is swept across the 2dplane and structure is
used for holding the maximal points lying to the left of the sweep line.
a) Array
b) Queue
c) Stack
d) Tree

48. The only way to convert a string of i characters into the empty string is
with i deletions, represented as _____________.
a) E(0.j) =j
b) E(i.j) = 1
c) E(0.i) = j
d) E (i.0)=I

49. . When a heapify procedure is applied to the root node to restore the heap, then at each
level, the comparison performed takes time:

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 13 of 45

a) It will take (log n).


b) It can not be predicted
c) It will take O (1).
d) Time will vary according to the nature of input data

50. If there are Θ (n²)entries in edit distance matrix then the total running time is:
a) θ (n)
b) θ (1)
c) θ (n2 )
d) θ (n logn)

51. _____ time is the maximum running time over all legal inputs.
a) Worst-case
b) Average-case
c) Best-case
d) Good-case

52. In average –case time analysis of quick sort algorithm , the mostbalanced case for
partion is when we divide the list of elements into _.
a) Equal no. of pieces as of input elements
b) Single piece exactly
c) Two nearly equal pieces
d) Three nearly equal pieces

53. Efficient algorithm requires less computational...


a) Memory
b) Running Time
c) Memory and Running
d) Energy

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 14 of 45

54. If matrix A of dimension p x q is multiplied with matrix B of dimension q x r, then each


entry in resultant matrix takes __________ time.
a) O (q) Page 84
b) (1)
c) (p x q)
d) (q x r)

55. For average-case time analysis of Quick sort algorithm, Pivot selection is on average
basis from ______
a) half of the input values
b) all possible random values
c) Pivot is input separately
d) values greater than 5

56. Fibonacci Sequence was named on _______, a famous mathematician in 12th Century.
a) Fred Brooks
b) Grady Booch
c) Leonardo Pisano
d) Edgar F. Codd

57. Selection algorithm takes theta ______


a) (n2)
b) (n)
c) log(n)
d) n log(n)

58. In quick sort algorithm, we choose pivot _______.


a) Always the smallest element
b) Greater than 5
c) Randomly

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 15 of 45

d) Less than 5
59. Recurrence can be described in terms of a tree.
a) Yes
b) No

60. For comparison-based sorting algorithms, it is possible to sort more efficiently than
Omega n log(n) time.
a) Always
b) Sometimes not
c) NOT
d) Sometimes

61. Time complexity of Dynamic Programming based algorithm for computing the
minimum cost of Chain Matrix Multiplication is ______
a) Log n
b) n
c) n^2 (n square)
d) n^3 (n cube)

62. The sequence of merge sort algorithm is:


a) Divide Combine-Conquer
b) Conquer-Divide-Combine
c) Divide-Conquer-Combine
d) Combine-Divide-Conquer

63. The Iteration method is used for ______


a) Comparing sorting algorithms only
b) Solving Recurrence relations
c) Merging elements in Merge sort
d) Dividing elements in Merge sort

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 16 of 45

64. 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
d) Fractional

65. In 3-Dimensional space, a point P has ______ coordinate(s).


a) (X, Y)
b) (X, 0)
c) (0, Y)
d) (X,Y, Z)

66. In Selection algorithm, we assume pivot selection takes theta __________ running time.
a) n
b) n2
c) n3
d) log (n)

67. Chain matrix multiplication problem can be solved through ______ strategy.
a) Dynamic programming
b) Greedy
c) Divide and conquer
d) Sorting

68. In Heap Sort algorithm (using max heap), when every time maximum element is
removed from top ___________.
a) We call merge Sort Algorithm
b) it becomes Order n2 Algorithm
c) Divide and Conquer strategy helps us

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 17 of 45

d) We are left with a hole

69. Merge sort have running time....running time of Heap sort. Not found exactly
a) Greater than
b) Less than
c) Equal to
d) Different than

70. _________ is a method of solving a problem in which we check all possible solutions to
the problem to find the solution we need.
a) Plane-Sweep Algorithm
b) Sorting Algorithm
c) Brute-Force Algorithm Google
d) Greedy approach

71. Median is not useful measure of central tendency of given input set especially when the
distribution of values is highly skewed.
a) True
b) False

72. The worst case running time of quick sort algorithm ____________.
a) Is quadratic
b) Is linear
c) Cannot be quadratic
d) ls always Exponential

73. We do not need to mathematically prove that for comparisonbased sorting algorithms
always takes Omega nlog (n) time.
a) True

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 18 of 45

b) False

74. In max heap (for Heap Sort algorithm), when every time maximum element is removed
from top we replace it with ___________ leaf in the tree.
a) Last
b) First
c) Any
d) Second last

75. The Omega-notation allows us to state only the asymptotic ______ bounds.
a) Middle
b) Lower
c) Upper
d) Both lower & upper

76. Quick sort algorithm was developed by –


a) AlferdAho
b) Sedgewick
c) John Vincent Atanasoff
d) Tony Hoare

77. Both lower & upper Sorting can be in ________


a) Increasing order only
b) Decreasing order only
c) Both Increasing and Decreasing order
d) Random order

78. If Matrix-A has dimensions “3×2” and Matrix-B has dimensions “2×3”, then
multiplication of Matrix-A and Matrix-B will result a new MatrixC having dimensions.

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 19 of 45

a) 3×2
b) 2×3
c) 2×2
d) 3×3

79. Radix sort performs sorting the numbers _______ digit (s) at a time.
a) One
b) Two
c) Three
d) All

80. In Sorting the key value or attribute __________ from an ordered domain.
a) Must be
b) Not always
c) May be
d) Occasionally

81. Quicksort is a/an ______ and ________ sorting algorithm.


a) Not in place, not stable one
b) In place , not stable one
c) In place, stable one
d) Not in place, stable one

82. Result of asymptotical analysis of n(n -3) and 4n*n is that _______
a) n(n-1) is asymptotically Less
b) n(n-1) is asymptotically Greater
c) Both are asymptotically Not equivalent
d) Both are asymptotically Equivalent

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 20 of 45

83. Consider three matrices X,Y,Z of dimensions 1x2, 2x3,3x4 respectively. The number of
multiplications of (XY) Z is:
a) 18
b) 32
c) 24
d) 30

84. Floor and ceiling are ______ to calculate while analyzing algorithms
a) Very easy
b) 3rd Option is missing
c) Usually considered difficult
d) 4th Option is missing

85. In Fibonacci Sequence, unnecessary repetitions do not exist at all.


a) True
b) False

86. ____ of reference is an important fact of current processor technology.


a) Defining
b) Assigning
c) Locality
d) Formality

87. It is not a Fibonacci sequence. 1,1,1,2,3,5,8,13,21,34,55,…..


a) True
b) False

88. In max-heap, largest element is stored at root node. Where is the smallest element
stored?

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 21 of 45

a) Right Node
b) Leaf Node
c) Middle Node
d) Left Node

89. Which of the following is calculated with Big Omega notation?


a) Medium bounds
b) Upper bounds
c) Lower bounds
d) Both upper and lower bounds

90. Identify the True Statement


a) The knapsack problem does not belong to the domain of optimization problems.
b) The knapsack problem belongs to the domain of optimization problems.
c) The Knapsack problem cannot be solved by using dynamic programming
d) The knapsack problem is optimally solved by using brute force algorithm.

91. In Dynamic Programming, our approach is to _________


a) Develop the solution in a top-down fashion
b) Express the problem non-recursively
c) Build the solution in a bottom-up fashion
d) Input several sub-problems simultaneously

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


a) K is large
b) K is small
c) K may be large or small
d) None

93. Matrix multiplication is a (n) ________ operation.

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 22 of 45

a) Commutative
b) Associative
c) Neither commutative nor associative
d) Commutative but not associative

94. 3. In Dynamic Programming approach, solution is modified / changed


a) Always once
b) At each stage
c) Only for specific problems
d) At 4th stage only

95. 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 knapsack.
a) Minimized
b) Decreased
c) Maximized
d) None of the given options

96. An in-place sorting algorithm is one that ________ uses additional array for storage.
a) Always
b) Permanently
c) Does not
d) Sometime

97. Dynamic Programming is a problem-solving approach in which___


a) Problem is solved in Zero time
b) Solution is developed only at final stage
c) Both are correct
d) Both are incorrect

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 23 of 45

98. When matrix A of 5 x 3 is multiplied with matrix B of 3 x 4 then the number of


multiplications required will be ____________.
a) 15
b) 12
c) 36
d) 60

99. Pseudo code of algorithms are to be read by _______.


a) People
b) RAM
c) Computer
d) Compiler

100. In order to say anything meaningful about our algorithms, it will be important for us
to settle on a ______.
a) Java Program
b) C++ Program
c) Pseudo program
d) Mathematically model of computation

101. What time does Merge Sort algorithm take in order to sort an array of ‘n’ numbers?
a) Θ (n)
b) Θ (log n)
c) Θ (n^2)
d) Θ(n log n)

102. algorithm, the first step is to ___________.


a) Call Build-Heap procedure
b) Sort the array in descending order
c) Call Heapify procedure

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 24 of 45

d) Find the number of input elements

103. The definition of theta-notation relies on proving ________ asymptotic


bound.
a) One
b) Lower
c) Upper
d) Both lower & upper

104. We can make _________ recursive calls in Fibonacci Sequence.


a) Infinite
b) Finite
c) Only one
d) Zero

105. Following is NOT the application of Edit Distance problem.


a) Speech recognition
b) Spelling Correction
c) Ascending Sort
d) Computational Molecular Biology

106. Time will vary according to the nature of input data. _____ time is the maximum
running time over all legal inputs.
a) Worst-case
b) Average-case
c) Best-case
d) Good-case

107. Selection algorithm takes theta ______

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 25 of 45

a) A.(n2)
b) (n)
c) log(n)
d) n log(n)

108. The Iteration method is used for ______


a) Solving Recurrence relations
b) Merging elements in Merge sort
c) Comparing sorting algorithms only
d) Dividing elements in Merge sort

109. In 3-Dimensional space, a point P has ______ coordinate(s).


a) (X, Y)
b) (X, 0)
c) (0, Y)
d) (X,Y, Z)

110. Merge sort have running time….running time of Heap sort. Not found exactly
a) Greater than
b) Less than
c) Equal to
d) Different than

111. Both lower &upperSorting can be in ________


a) Random order
b) Increasing order only
c) Decreasing order only
d) Both Increasing and Decreasing order

112. Quicksort is a/an _______ and ________ sorting algorithm.

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 26 of 45

a) Not in place, not stable one


b) In place, not stable one
c) In place , stable one
d) Not in place , stable one

113. Consider three matrices X,Y,Z of dimensions 1×2, 2×3,3×4 respectively. The number
of multiplications of (XY) Z is:
a) 18
b) 32
c) 24
d) 30

114. In Dynamic Programming, our approach is to ____________.


a) Express the problem non-recursively
b) Build the solution in a bottom-up fashion
c) Develop the solution in a top-down fashion
d) Input several sub-problems simultaneously

115. Matrix multiplication is a(n) _______ operation.


a) Commutative
b) Associative
c) Neither commutative nor associative
d) Commutative but not associative

116. In Dynamic Programming approach, solution is modified/changed _________.


a) Always once
b) At each stage
c) Only for specific problems
d) At 4th stage only

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 27 of 45

117. An in-place sorting algorithm is one that ___________ use(s) additional array for
storage.
a) Always
b) Permanently
c) Does not
d) Sometime

118. In Fibonacci Sequence, each term is calculated by_______ previous ______ terms.
a) Subtracting, Two
b) Adding, Three
c) Adding, Two
d) Multiplying, Two

119. Sorting is performed on the basis of ___________.


a) Computational resources
b) Asymptotic notation
c) Summation
d) Some key value of attribute

120. ___________ provides us more accurate result, when input values are not closer with
each other.
a) Mode
b) Mean
c) Average
d) Median

121. Rank of an element can be defined as ____________


a) One minus the number of elements that are smaller
b) Two plus the number of elements that are greater
c) One plus the number of elements that are smaller

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 28 of 45

d) Two minus the number of elements that are smaller

122. If the time complexity of an algorithm is given by O (1), then its time complexity would
be
a) Polynomial
b) Exponential
c) Constant
d) Average

123. In Sieve technique, we solve the problem _________


a) In recursive manner
b) Non recursively
c) Using Merge Sort algorithm
d) Using Brute force technique

124. Sorting is performed on the basis of ___________.


a) Computational resources
b) Asymptotic notation
c) Summation
d) Some key value of attribute

125. _______ provides us more accurate result when input values are not closer with each
other
a) Average
b) Median
c) Mode
d) Mean

126. Rank of an element can be defined as ___________.

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 29 of 45

a) One minus the number of elements that are smaller


b) Two plus the number of elements that are greater
c) One plus the number of elements that are smaller
d) Two minus the number of elements that are smaller

127. Approach of solving geometric problems by sweeping a line


across the plane is called _____ sweep.
a) Line
b) Plane
c) Cube
d) Box

128. In the analysis of Selection algorithm, we get the convergent _________


a) Harmonic
b) Linear
c) Arithmetic
d) Geometric

129. A Random Access Machine (RAM)is an idealized machine


With random access memory.
a) Infinite large
b) 512 MB
c) 256 MB
d) 2 GBs

130. f(n) and g(n) are asymptotically equivalent. This means


that they have essentially the same ______.
a) Results
b) Variables

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 30 of 45

c) Size
d) Growth rates

131. An algorithm is a mathematical entity. Which is independent of _______.


a) Programming language
b) Machine and Programming language
c) Compiler and Programming language
d) Programming language Compiler and Machine

132. Fibonacci Sequence was named on ______, a famous


mathematician in 12th Century.
a) Fred Brooks
b) Grady Booch
c) Leonardo Pisano
d) Edgar F. Codd

133. In Heap Sort algorithm, if heap property is violated


a) We call Build heap procedure
b) We call Heapify procedure
c) We ignore
d) Heap property can never be violated

134. In Selection problem, the Sieve technique works in __________.


a) Non-recursive manner
b) Constant time
c) Phases
d) One complete go

135. In Selection problem, the Sieve technique _________.

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 31 of 45

a) Add some more input items each time


b) Do not work recursively
c) Do not uses Divide and Conquer approach
d) Eliminates undesired data items each time

136. For solving Selection problem, we introduced Sieve technique due to _______
a) Using Decrease and Conquer strategy
b) Avoiding to sort all input data
c) Eliminating Rank of an element
d) Using Brute-force approach

137. Dynamic programming comprises of _______.


a) Recursion only
b) Repetition only
c) Recursion with Repetition
d) No Repetition but Recursion

138. In in-place sorting algorithm is one that uses arrays for storage.
a) No additional array
b) An additional array
c) Both of above may be true according to algorithm
d) More than 3 arrays of one dimension

139. Quick sort is.


a) Stable & in place
b) Not stable but in place
c) Stable but not in place
d) Some time stable & some

140. Random access machine or RAM is a/an.

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 32 of 45

a) Machine build by Al-Khwarizmi


b) Mechanical machine
c) Mathematical model
d) Electronics machine

141. A heap is a left-complete binary tree that confirms to the ________.


a) increasing order only
b) decreasing order only
c) heap order
d) log n order

142. For 2D Maxima problem. Plane Sweep algorithm first of all _________.
a) Sorts all points
b) Delete some points
c) Output the elements
d) Pushes all points on stack

143. Selection sort is a ______ sorting algorithm


a) In-place
b) Not In-Place
c) Stable
d) in-partition

144. Cubic function will ________ a quadratic function.


a) Prove
b) be equal to
c) overtake
d) find

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 33 of 45

145. To check whether a function grows faster or slower than the other function, we use
some asymptotic notations, which is ________.
a) Big-oh notation
b) Theta notation
c) Omega notation
d) All of the given

146. In inductive approach of knapsack problem, we consider 2 cases, _______Or ________.


a) Median, Mode
b) Recursive, Iterative
c) Leave object, Take object
d) Sequentially. Parallel

147. Using _______ algorithm, efficiency is not given much importance


a) Greedy
b) Merge sort
c) Processing
d) Brute Force

148. If matrix A of dimension p × q is multiply with matrix B of


dimension q × r, then dimension of resultant matrix is:
a) p×q
b) p×r
c) q×r
d) r×p

149. Which one is not passed as parameter in Quick sort algorithm?


a) End of the array
b) Start of the array
c) Middle of the array

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 34 of 45

d) Array

150. In Random Access Machine (RAM), instructions are executed in


a) Parallel
b) Batch
c) One by One
d) Multiple times

151. In selection problem, the rank of an element will be its _____ position
a) First
b) final
c) Second last
d) Last

152. f(n) and g(n) are asymptotically equivalent. This means that they have essentially the
same ______.
a) Size
b) Results
c) Variables
d) Growth Rates

153. In Quick sort algorithm, Pivots form ___


a) Stack
b) Queue
c) Graph
d) Binary Search Tree

154. In asymptotical analysis of n'(5 2)-3, as n becomes large, the dominant (fastest growing)
term is some constant times

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 35 of 45

a) n_1
b) n
c) n+1
d) n*n p-23

155. In Heap Sort algorithm, if heap property is violated:


a) We ignore.
b) We call Heapify procedure
c) We call Build Heap procedure.
d) Heap property can never be violated.

156. To find maximal points in brute-force algorithm each point of the space is compared
against ______ of that space.
a) One other point
b) All other points Page 11
c) Few other points
d) Most of the other points

157. In Selection problem, the Sieve technique ___________


a) Add some more input items each time
b) Do not work recursively
c) Do not uses Divide and Conquer approach
d) Eliminates undesired data items each time

158. Consider three matrices X, Y, Z of dimensions 1 x 2 , 2 x 3 , 3 x 4


respectively. The number of multiplications of (XY)Z is:
a) 16
b) 32
c) 30
d) 26

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 36 of 45

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


an object i , then we gain______
a) A.W(Total Weight of Knapsack)
b) V (Total Value of all items)
c) vi (Value of object i)
d) None of the given option

160. In quick sort algorithm, _________ decides nature of Binary Search Tree formed by
pivots.
a) Rank of the pivot
b) Middle element from input
c) Smallest element from input
d) Largest element from input

161. In the clique cover problem, for two vertices to be in the same group,
they must be ______ each other.
a) Apart from
b) Far from
c) Near to
d) Adjacent to

162. In in-place sorting algorithm is one that uses arrays for storage.
a) No additional array
b) An additional array
c) Both of above may be true according to algorithm
d) More than 3 arrays of one dimension

163. Quick sort is.

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 37 of 45

a) Not stable but in place


b) Stable but not in place
c) Stable & in Place
d) Some time stable & some times in place

164. For the Sieve Technique we take time.


a) T(nk)
b) IT(n / 3)
c) n^2
d) n/

165. Asymptotic growth rate of the function is taken over ______ case running time.
a) Worst
b) Average
c) Best
d) Normal

166. A heap is a left-complete binary tree that confirms to the ________.


a) increasing order only
b) decreasing order only
c) heap order
d) log n order

167. In brute force algorithm, we measure running time T(n) based on ____.
a) Worst-case time and best-case time
b) Worst-case time and average-case time
c) Average-case time and best-case time
d) Best-case time and staring-case time

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 38 of 45

168. _________ is the process of avoiding unnecessary repetitions by writing down the
results of recursive calls and looking them up again if we need them later.
a) Loop
b) Function
c) Recursion
d) Memorization

169. In average-case time the probability of seeing input is denoted by ____.


a) p{I}
b) p[I]
c) p<i>
d) p(i)

170. Number of _______ of the pseudo code are counted to measure the running time.
a) Inputs
b) Outputs
c) Steps
d) Pages

171. In bin sort, each bin can be replaced by a ______________ in case of duplication.
a) Heap
b) Stack
c) Hash table
d) Linked list

172. In merge sort algorithm, we split the array ______ to find index q.
a) from end
b) from start
c) midway
d) both from start or end

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 39 of 45

173. Find the maximum value of the items which can carry using knapsack
Knapsack weight capacity = 50.
Item Weight Value
11070
22020
33080
470 200
a) 90
b) 280
c) 200
d) 100

174. Sorting can be in ______________.


a) Increasing order only
b) Decreasing order only
c) Both increasing and decreasing order
d) Random order

175. Recurrence can be described in terms of_____________.


a) Array
b) Linear
c) Tree
d) Graph

176. The brute-force algorithm for 2D-Maxima runs in order O(__) time.
a) n
b) n(log n)
c) n*n

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 40 of 45

d) n3

177. _________ is always based on divide and conquer strategy.


a) Bubble sort
b) Selection sort
c) Pigeon sort
d) Quick sort

178. If a matrix has three rows and two columns, then dimensions of matrix will be:
a) 3×2
b) 2×3
c) 3×3
d) 2×2

179. In recursive formulation of knapsack Problem: V [0, j] = ____ for j>=0


a) 2
b) -1
c) 1
d) 2

180. ________ is a linear time sorting algorithm.


a) Merge sort
b) Radix sort
c) Quick sort
d) Bubble sort

181. While analyzing algorithms, __________and ___________ are usually


considered difficult to calculate.
a) Floor, ceiling

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 41 of 45

b) Row, Column
c) Finite, Infinite
d) Graph, Tree

182. In 2d-maximal problem, a point is said to be if it is not dominated by any other point
in that space.
a) Member
b) Minimal
c) Maximal
d) Joint

183. We can use the _______________ property to devise a recursive formulation of the edit
distance problem.
a) Small substructure
b) Algorithmic
c) Real
d) Optimal substructure

184. The problem with the brute-force algorithm is that is uses ________ in pruning out de
a) Worst-case time
b) No intelligence
c) Outside looping
d) Artificial intelligence

185. Boolean operation is a _________ operation on an idealized RAM model of


computation.
a) Advance
b) String
c) Basic
d) Normal

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 42 of 45

186. The running time of quick sort algorithm_________.


a) Is impossible to compute
b) Has nothing to do with pivot selection
c) Is Random upon each execution
d) Greatly influenced by the selection of pivot

187. In 2-d maxima problem a point p is said to be dominated by point q if


_________.
a) p.x <= q.x
b) p.x <= q.x and p.y <= q.y
c) p.y <= q.y
d) p.x >= q.x and p.y >=q.y

188. Which of the following is calculated with Big Omega notation?


a) Medium bounds
b) Upper bounds
c) Lower bounds
d) Both upper and lower bounds

189. In 2d-maximal problem, a point is said to be if it is not dominated by any other point
in that space.
a) Member
b) Minimal
c) Maximal
d) Joint

190. The following sequence is called ____________


1,2,3,5,8,13,21,34,55,…..

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 43 of 45

a) Optimize sequence
b) Fibonacci sequence
c) Optimal sequence
d) Overlapping sequence

191. In chain matrix multiplication, table is filled _________ to find the multiplication of
matrix.
a) row wise
b) column wise
c) diagonally
d) bottom-to-up

192. The number of nodes in a complete binary tree of


height h is:
a) 2 * (h+1) - 1
b) 2^(h+1) – 1
c) 2 * (h+1)
d) ((h+1)^2) – 1

193. In ___________, Leonardo of Pisa, also called Fibonacci, published a book.


a) 1102
b) 1202
c) 1400
d) 1304

194. Algorithms similar to those for the ______________ problem are used
in some speech recognition systems.
a) Counting
b) heap sort
c) Fibonacci

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 44 of 45

d) edit-distance

195. In his book ______________, Leonardo Pisano addressed the Fibonacci


sequence as well as a variety of other problems.
a) Liber fib
b) Fib abaci
c) Fibonacci
d) Liber abaci

196. We can multiply two matrices A and B only when they are compatible
which means:
a) Number of rows and columns do not matter
b) Number of rows in A must be equal to number of rows in B
c) Number of columns in A must be equal to number of rows in B
d) Number of columns in A must be equal to number of columns in B

197. _______ overcomes the limitations of ________ by working as per positional notations
of numbers.
a) Bubble sort, Radix sort
b) Radix sort, Bubble sort,
c) Counting sort, Radix sort
d) Radix sort, Counting sort

Contact us on WhatsApp 0328-4090195


Mid-Term CS502(Fundamentals of Algorithms) Page 45 of 45

Best of Luck

For Free help, more Mid/Final term Files and for Exam Preparation :You Can
Join:

Contact us on WhatsApp 0328-4090195

You might also like