0% found this document useful (0 votes)
149 views

ALGORITHUM

1. The document discusses various algorithms and data structure concepts. It provides multiple choice questions to test understanding of these concepts. 2. Key algorithm efficiency measures discussed include time complexity, measured by counting operations, and space complexity, measured by maximum memory usage. 3. Common data structures addressed are arrays, linked lists, trees, and graphs. Linear data structures like arrays and linked lists store elements in a sequential manner while non-linear structures like trees and graphs have non-sequential relationships. 4. Recursive algorithms and their time complexities are covered. Various sorting and search algorithms are analyzed, including their best, average, and worst-case time complexities.

Uploaded by

madhuri nimse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views

ALGORITHUM

1. The document discusses various algorithms and data structure concepts. It provides multiple choice questions to test understanding of these concepts. 2. Key algorithm efficiency measures discussed include time complexity, measured by counting operations, and space complexity, measured by maximum memory usage. 3. Common data structures addressed are arrays, linked lists, trees, and graphs. Linear data structures like arrays and linked lists store elements in a sequential manner while non-linear structures like trees and graphs have non-sequential relationships. 4. Recursive algorithms and their time complexities are covered. Various sorting and search algorithms are analyzed, including their best, average, and worst-case time complexities.

Uploaded by

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

ALGORITHUM

1. Two main measures for the efficiency of an algorithm are

a. Processor and memory b. Complexity and capacity

c. Time and space d. Data and space.

2. The indirect change of the values of a variable in one module by another module
is called

a. internal change b. inter-module change

c. side effect d. side-module update

3. Which of the following data structure is not linear data structure?

a. Arrays b. Linked lists

c. Both of above d. None of above

4. Which of the following data structure is linear data structure?

a. Trees b. Graphs

c. Arrays d. None of above

5. The operation of processing each element in the list is known as

a. Sorting b. Merging

c. Inserting d. Traversal

6. Finding the location of the element with a given value is:

a. Traversal b. Search

c. Sort d. None of above

7. In the following C function, let n >= m.

int gcd(n,m)

if (n%m ==0) return m;

n = n%m;
return gcd(m,n);

How many recursive calls are made by this function?

a. theta(log n) b. omega(n)
C. theta (log log n) d. Theta (sqrt(n))

8. …………… is a method of expressing algorithms by a collection of geometric shapes


with imbedded descriptions of algorithmic steps

1.Flow chart 2.chart

3.differntial method 4.numerical method

9. 
The time factor when determining the efficiency of algorithm is measured by
Counting microseconds
A
.
B Counting the number of key operations
.
C Counting the number of statements
.
D Counting the kilobytes of algorithm
.
10. 
The space factor when determining the efficiency of algorithm is measured by
A Counting the maximum memory needed by the algorithm
.
B Counting the minimum memory needed by the algorithm
.
C Counting the average memory needed by the algorithm
.
D Counting the maximum disk space needed by the algorithm
.
11. 
Which of the following case does not exist in complexity theory
A Best case
.
Worst case
B.
C Average case
.
D Null case
.
12. The Worst case occur in linear search algorithm when
A
Item is somewhere in the middle of the array
.
B Item is not in the array at all
.
C
Item is the last element in the array
.
D Item is the last element in the array or is not there at
. all
13. 
The Average case occur in linear search algorithm
When Item is somewhere in the middle of the array
A
.
B
When Item is not in the array at all
.
C When Item is the last element in the array
.
When Item is the last element in the array or is not there at
D
all
.
14. 
The complexity of the average case of an algorithm is
A
Much more complicated to analyze than that of worst case
.
B Much more simpler to analyze than that of worst case
.
Sometimes more complicated and some other times simpler than that of worst
C
case
.
D None or above
.
15. 
The complexity of linear search algorithm is
A O(n)
.
B
O(log n)
.
C O(n2)
.
D O(n log n)
.
16. 
The complexity of Binary search algorithm is
A O(n)
.
B O(log )
.
C O(n2)
.
D O(n log n)
.
17. 
The complexity of Bubble sort algorithm is
A O(n)
.
B O(log n)
.
C O(n2)
.
D O(n log n)
.
18
The complexity of merge sort algorithm is
.
A O(n)
.
B O(log n)
.
C O(n2)
.
D O(n log n)
.
19. The indirect change of the values of a variable in one module by another module
is called
A internal change
.
B inter-module change
.
C side effect
.
D side-module update
.
20. Which of the following data structure is not linear data
structure?
A Arrays
.
B Linked lists
.
C Both of above
.
None of above
D.
21. 
Which of the following data structure is linear data structure?
A Trees
.
B
Graphs
.
C
Arrays
.
None of above
D.
22. 
The operation of processing each element in the list is known as
A
Sorting
.
B
Merging
.
C
Inserting
.
D
Traversal
.
23. 
Finding the location of the element with a given value is:
A
Traversal
.
B. Search
C
Sort
.
None of above
D.
24. 
Arrays are best data structures
A for relatively permanent collections of data
.
for the size of the structure and the data in the structure are constantly
B
changing
.
C for both of above situation
.
D for none of above situation
.
25. 
Linked lists are best suited
for relatively permanent collections
A
of data
.
for the size of the structure and the data in the structure are constantly
B
changing
.
C for both of above situation
.
D for none of above situation
.
26. Each array declaration need not give, implicitly or explicitly, the information
about
A the name of array
.
the data type of array
B.
C the first data from the set to be stored
.
D the index set of the array
.
27. The elements of an array are stored successively in memory cells
because
A by this way computer can keep track only the address of the first element and
. the addresses of other elements can be calculated
the architecture of computer memory does not allow arrays to store other
B
than serially
.
C both of above
.
D. none of above

28. The time factor when determining the efficiency of algorithm is measured
by

a. Counting microseconds

b. Counting the number of key operations

c. Counting the number of statements

d. Counting the kilobytes of algorithm

29. The space factor when determining the efficiency of algorithm is measured
by

a. Counting the maximum memory needed by the algorithm

b. Counting the minimum memory needed by the algorithm

c. Counting the average memory needed by the algorithm

d. Counting the maximum disk space needed by the algorithm


30. Which of the following case does not exist in complexity theory

a. Best case

b. Worst case

c. Average case

d. Null case

31.The complexity of the average case of an algorithm is

a. Much more complicated to analyze than that of worst case

b. Much more simpler to analyze than that of worst case

c. Sometimes more complicated and some other times simpler than that of
worst case

d. None or above

32.Which of the following data structure can't store the non-homogeneous data
elements?
a. Arrays
b. Records
c. Pointers
d. None

33.Which of the following data structure store the homogeneous data


elements?
a. Arrays
b. Records
c. Pointers
d. None

34.Each data item in a record may be a group item composed of sub-items;


those items which are indecomposable are called
a. elementary items
b. atoms
c. scalars
d. all of above

35. A data structure where elements can be added or removed at either end but
not in the middle
a. Linked lists
b. Stacks
c. Queues
d. Deque

36.  Which of the following data structure is non-linear type?


a. Strings
b. Lists
c.   Stacks
d. None of above

37.  Which of the following data structure is linear type?


a. Strings
b. Lists
c.   Queues
d. All of above

38.  To represent hierarchical relationship between elements, which data


structure is suitable?
a. Deque
b. Priority
c. Tree
d. All of above

39.  An algorithm that calls itself directly or indirectly is known as


a. Sub algorithm
b. Recursion
c.   Polish notation
d. Traversal algorithm

40. The running time of an algorithm T(n),where 'n' is the input size, of a
recursive algorithm is given as follows.is given by

          T(n) =c + T(n - 1), if n > 1

            d, if n  ≤  1
The order of this algorithm is

A.n2 B.N C.N3 D.NN


Explination:By recursively applying the relation we finally arrive at
T(n-I) = c(n-I) + T (1) = c(n-I)+d
So, order is n

41. There are 4 different algorithms AI, A2, A3, A4 to ·solve a given problem
with the order Iog(n), log(log(n)), nIog(n) ,n / log(n) respectively. Which is the
best algorithm?

A.A1 B.A2 C.A3 D.A4


42. The concept of order (Big O) is important because
A.it can be decide the best algorithum to solves given problems.
B. it determines that maximum size of problem that can be solve in a given
system in a given amount of time.
C. both (A) and (B)
D.None of above

43. The order of an algorithm that finds whether a given Boolean function of 'n'
variables, produces a 1 is
A. constant B. Linear C. algorithmic D. Exponential .

Explanation :
Let T(1) = T(2) = T(3) = k (say). Then T(4) = k + k - k = k
T(5) = k+ k- k= k.
By mathematical induction it can be proved that T(n) = k, a constant.

44. Which of the following algorithms solves the all-pair shortest path problem?
A. Dijkstra's algorithm
B. Floyd's algorithm
C. Prim's algorithm
D. Warshall's algorithm.

Explanation :

Dijkstra's algorithm solves single source shortest path problem. Warshall's


algorithm finds transitive closure of a given graph. Prim's algorithm constructs
a minimum cost spanning tree for a given weighted graph.

45. Unrestricted use of goto is harmful, because it.


A. Makes debugging difficult.
B.Increse the running time of program.
C.increse memory requirement of program
D. result in compiler generating longer machine code.

46. Which of the following algorithm design technique is used in the quick sort
algorithm?
A.Dynamic programming
B. backtracking
C.divide and conquer
D. Greedy method

47. The data structure has the following components


1. Algorithm, storage structure and function of implementation
2.Algorithm, data type and function of implementation
3. Function, storage structure and program
4. Algorithm, data structure and program
48. Divide and conquer strategy follows in
1. Quick sort
2.Heap Sort
3.Bubble Sort
4.Marge sort

BINARY SEARCH AND LINEAR SEARCH:

49.Which of the following is not the required condition for binary search algorithm?

a. The list must be sorted


b. there should be the direct access to the middle element in any sublist
c. There must be mechanism to delete and/or insert elements in list
d. none of above
 

50. Which of the following is not a limitation of binary search algorithm?

a. must use a sorted array


b. requirement of sorted array is expensive when a lot of insertion and deletions are
needed
c. there must be a mechanism to access middle element directly
d. binary search algorithm is not efficient when the data elements are more than
1000.

51. Binary search algorithm can not be applied to


a. sorted linked list
b. sorted binary trees
c. sorted linear array
d. pointer array.

52.The Worst case occur in linear search algorithm when

a. Item is somewhere in the middle of the array

b. Item is not in the array at all

c. Item is the last element in the array

d. Item is the last element in the array or is not there at all

53.The Average case occur in linear search algorithm

a. When Item is somewhere in the middle of the array


b. When Item is not in the array at all

c. When Item is the last element in the array

d. When Item is the last element in the array or is not there at all

54.The complexity of linear search algorithm is

a. O(n)

b. O(log n)

c. O(n2)

d. O(n log n)

55. The complexity of Binary search algorithm is

a. O(n)

b. O(log )

c. O(n2)

d. O(n log n)

56. Linear search is not possible over sorted list

1. YES 2.NO

57. In binary search

1. Elements must be in arranging order

2. Elements must not be in arranging order

58. What is the average number of comparisons in linear search

1.(n+1)/2

2.(2n+1)/2

3.(n+1)

4.2(n+1)

59. Which of the following is not the required condition for the binary search
algorithm?

1. The list must be sorted


2. There should be the direct access to the middle element in any sublist

3. There must be mechanism to delete and/or insert elements in the list

4. None of above

SORTING:

60. The complexity of Bubble sort algorithm is

a. O(n)

b. O(log n)

c. O(n2)

d. O(n log n)

61. The complexity of merge sort algorithm is

a. O(n)

b. O(log n)

c. O(n2)

d. O(n log n).

62.  Which of the following sorting algorithm is of divide-and-conquer type?


a. Bubble sort
b. Insertion sort
c. Quick sort
d. All of above

63.Which one of the following in place sorting algorithms needs the minimum
number of swaps?

• Quick sort

• Insertion sort

• Selection sort

• Heap sort

64.Which sorting algorithm is faster


1. O (n log n)
2. O n^2
3. O (n+k)
4. O n^3

65. Quick sort is


1. Stable & in place
2. Not stable but in place
3. Stable but not in place
4. Some time stable & some times in place

66. One example of in place but not stable algorithm is


1. Merger Sort
2. Quick Sort
3. Continuation Sort
4. Bubble Sort

67. In Quick Sort Constants hidden in T(n log n) are


1. Large
2. Medium
3. Small
4. Not Known

68. In stable sorting algorithm.


1. If duplicate elements remain in the same relative position after sorting
2. One array is used Imrangee
3. More than one arrays are required
4. Duplicating elements not handled

69. Which may be a stable sort?


1. Merger
2. Insertion
3. Both above
4. None of the above

70. An in place sorting algorithm is one that uses ___ arrays for storage
1. Two dimensional arrays
2. More than one array
3. No Additional Array
4. None of the above

71. Continuing sort has time complexity of ?


1. O(n)
2. O(n+k)
3. O(nlogn)
4. O(k)

72. In case of external sorting algorithm


1. Need to check the secondary disk access type

2. Need to check the primary memory access type

3. None of the above

4. a) and b) both should be checked

73. Marge sort continues its division until n elements in the list.the value of n is:

1.0 2.1 3.2 4.3

74. What is the maximum number of comparisons in a binary search

1. [log2n]+1

2. [ log10n]+1

3 . [log2n]+2

4. [log10n]+2

75. For searching a page from your book , which method is generally used

1. Linear Search

2.Binary Search

76. Sorting means

1. Order in a first come first serve

2.order in ascending or descending of values

77. What is the external sorting


1.Bubble sort
2.Quick sort
3.Merge sort
4.Seletion sort

78. Internal sorting mainly done in


1.Main memory
2.Secondary Memory

79.for heap sort


1. First create heap then sort
2. First sort then creates heap
3. Need not to create heap
4. Just create heap and no required to sort further
80. The time complexity of Bubble Sort is
1.O(n)
2.O(n2)
3.O(n log n)
4.O(log n)

81. Which one is stable sort?


1.bubble sort
2.selection sort
3.Inertion sort
4.Quick sort

82. Representation of data structure in memory is known as:

1.recursion 2.abstract data type

3.storage structure 4.file structure

83. Quick sort is also known as

1.merge sort 2.heap sort

3.bubble sort 4.none of these

84. An algorithm is made up of two independent time complexities f (n) and g (n).
Then the
complexities of the algorithm is in the order of

1.f(n) x g(n) 2.Max(f(n),g(n))

3.Min(f(n),g(n)) 4.f(n)+g(n)

85. The goal of hashing is to produce a search that takes

1.O(1) time 2.O(n2) time

3.O(log n) time 4.O(n log n)time

86. The best average behaviour is shown by

1.Quick sort 2.Merge sort

3.Insertion sort 4.Heap sort

87. Consider that n elements are to be sorted. What is the worst case time
complexity of
Bubble sort?
1.O(1) 2.O(log2n)

3.O(n) 4.O(n2)

88. A characteristic of the data that binary search uses but the linear search ignores
is
the___________.

1. Order of the elements of the list.


2. Length of the list.
3. Maximum value in list.
4. Type of elements of the list.

89. The average search time of hashing with linear probing will be less if the load
factor  ?

1. is far less than one

2. equals one

3. is far greater than one

4. none of above

90. As part of maintenance work, you are entrusted with the work of rearranging
the library books in a shelf in proper order, at the end of each day. The ideal choice
will be ?

1. Bubble sort 2.Insertion sort

3.Selection sort 4.Heap sort

91. The way a card game player arranges his cards as he picks them  up one by one,
is an example of ?

1. Bubble sort 2.Insertion sort

3.Selection sort 4.Heap sort

92.which of the following can be used as a criterion for classification of data


structure used in language processing?

1. nature of a data structure

2. lifetime of data structure

3. purpose of a data structure

4. all
93. A technique for direct search is

1.Binary search 2.Linear search

3. Tree search 4.Hashing

94. The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using


Bubble Sort is
1.6 2.5
3.7 4.8
95. The OS of a computer may periodically collect all the free memory space to form
contiguous block of free space. This is called
1.concatenation 2.Garbage collection
3.Collision 4. Dynamic memory allocation
96. You have to sort a list L consisting of a sorted list followed by a few “random”
elements.
Which of the following sorting methods would be especially suitable for such a task?
1.bubble sort 2.selection sort
3.Quick sort 4.Insertion sort
97. Merging 4 sorted files containing 50, 10, 25 and 15 records will take____time
1.O(100) 2.O(200)
3.O(175) 4.O(125)
98. A linear list of elements in which deletion can be done from one end (front) and
insertion can take place only at the other end (rear) is known as a
1.Queue 2.stack
3.tree 4.inked list
99. Heap allocation is required for languages
1. That support recursion
2. That use dynamic scope rules
3.That support dynamic data structure

4. All of above

100.Choose the statements that are syntactically correct.


1. /*  Is /* this a valid */ comment */

2. for( ; ;);

3.return;

4.both (2) and (3)

101. When a variable of data type double is converted into float, then

1.rounding takes place

2.truncation takes place

3.the lower order bites are dropped

4.none of these

102. To sort many large object or structures, it would be most efficient to

1. Place reference to them in and array an sort the array

2. Place them in a linked list and sort the linked list

3. Place pointers to them in an array and sort the array

4. Place them in an array and sort the array

103. To sort many large objects or structures, it would be most eficient to place

1. Them in an array and sort the array

2.Pointers to them in an array and sort the array

3.Them in a linked list and sort the linked list

4.References to them in an array and sort the array

104. Suppose DATA array contains 1000000 elements. Using the binary search
algorithm, one requires only about n comparisons to find the location of an item in
the DATA array, then n is

1. 60 2. 45 3. 20 4. None of these

105. Which of the following sorting procedure is the slowest ?

1.Quick sort 2.Heap sort

3.Shell sort 4.Bubble sort


106. Which of the following best describes sorting ?

1. Accessing and processing each record exactly once

2.Finding the location of the record with a given key

3.Arranging the data (record) in some given order

4.Adding a new record to the data structure

107. Using the standard algorithm, what is the time required to determine that a
number n is prime ?

1. Linear time 2. Logarithmic time

3. Constant time 4. Quadratic time

108. Which of the following is false ?

1. A serial search begins with the first array element

2.A serial search continues searching, element by element, either until a match is
found or until the end of the array is encountered

3.A serial search is useful when the amount of data that must be search is small

4.For a serial search to work, the data in the array must be arranged in either
alphabetical or numerical order

109. A search begins the search with the element that is located in the middle of the
array

1. serial 2.random

3.parallel 4.binary

110. A sort which iteratively passes through a list to exchange the first element with
any element less than it and then repeats with a new first element is called

1. insertion sort 2. Selection sort

3.heap sort 4.quick sort

111. Which of the following statements is used in the binary search algorithm to
halve the array ?

1. middle Sub = (start Sub + stop Sub)/2;

2.middle Sub = start Sub + stop Sub/2;


3.middle Sub = middle Sub/2;

4.middle Sub = (stop Sub - start Sub)/2;

112. The data for which you are searching is called

1. search argument

2.sorting argument

3.detection argument

4.binary argument

113. If the binary search algorithm determines that the search argument is in the
lower half of the array, which of the following statements will, set the appropriate
variable to the appropriate value?

1. start Sub = middle Sub - 1;

2.start Sub = middle Sub + 1;

3.stop Sub = middle Sub - 1;

4.stop Sub = middle Sub + 1.

114. Which of the following is false

1. A binary search begins with the middle element in the array

2.A binary search continues having the array either until a match is found or until
there are no more elements to search

3.If the search argument is greater than the value located in the middle of the
binary, the binary search continues in the lower half of the array

4.For a binary search to work, the data in the array must be arranged in either
alphabetical or numerical order

115. You want to check whether a given set of items is sorted. Which of the
following sorting methods will be most efficient if it is already in sorted order?

1. Bubble sort 2.Selection sort

3.Insertion sort 4.Merge Sort

116. Which of the following sorting methods will be the best if number of swappings
done, is the only measure of efficienty?
1. Bubble sort 2.Selection sort

3.Insertion sort 4.Quick sort

117. You are asked to sort 15 randomly generated numbers. You should prefer

1. Bubble sort 2.Selection sort

3.Insertion sort 4.Quick sort

118. Sorting is useful for

1. report generation 2.responding toe queries easily

3.making searching easier and efficient

4.All of these

119. Choose the correct statements

1. Internal sorting is used if the number of items to be sorted is very large.

2.External sorting is used if the number of items to be sorted is very large

3.External sorting needs auxilary storage

4.Both (2) & (3)

120. A sorting technique that guarantees that records with the same primary key
occurs in the same order in the sorted list as in the original unsorted list is said to be

1. Stable 2. Consistent

3. external 4. Linear

121. In eveluating the arithmetic expression 2*3-(4+5),using stacks to evaluate its


equivalent postfix form, which of the following stack configuration is not possible?

1. 4 6 2. 5 4 6

3.9 6 4.9 3 2

122. Merge sort uses

1. divide and conquer strategy

2.backtracking approach

3.heuristic search
4.greedy approach

123. A machine took 200 see to sort 200 names, using bubble sort. In 800 sec, it can
approximately sort

1. 400 names 2.800 names

3.750 names 4.800 names

Explanation :

For sorting 200 names bubble sort makes 200x(199/2)= 19900 c9omaprisons. The
time needed for 1 comparison is 200 sec (approximately). In 800 sec it can make
80,000 comparisons. We  have to find n, such that n(n-1)/2= 80,000. Solving, n is
approximately 400.

124. Which of the following is useful in implementing quick sort?

1. stack 2.set

3. List 4.Queue

125. The recurrence relation that arises in relation with the complexity of binary
search is

1. T(n)= T(n/2)+k, where k is a constant

2.T(n)= 2 T(n/2)+k, where k is a constant

3.T(n) = T(n/2)+log(n)

4.T(n) = T (n/2) + n

126. The statement


# include < math.h>
is written at the top of a program to indicate

1. Beginning of the program.

2. that certain information about mathematical library functions are to be included


at the begnning of the program.

3.ending of the program.

4.none of these

127. Which header file is used for screen handling function:-

(A) IO.H (B) STDLIB.H


(C) CONIO.H (D) STDIO.H

Ans: D

The header file stdio.h contains definitions of constants,macros and types, along
with

function declarations for standard I/O functions.

128. Choose the directive that is used to remove previously defined definition of the
macro

name that follows it -

(A) # remdef (B) # pragma

(C) # undef (D) # define

Ans: C

The preprocessor directive #undef OKAY would cause the definition of OKAY to be

removed from the system.

129. Which of the following statement is true about a function?

(A) An invoking function must pass arguments to the invoked function.

(B) Every function returns a value to the invoker.

(C) A function may contain more than one return statement.

(D) Every function must be defined in its own separate file.

Ans: A

An invoking function must pass arguments to the invoked function.

130. For implementing recursive function the data structure used is:

(A) Queue (B) Stack

(C) Linked List (D) Tree

Ans: B

For implementing recursive function, stack is used as a data structure.

131. The void type is used for

(A) Returning the value (B) creating generic pointers


(C) Creating functions (D) Avoid error

Ans: B

The void type is used to create generic pointers.

132. The variable that are declared outside all the functions are called ______.

(A) Local variable (B) Global variable

(C) Auto variable (D) None of the above

Ans: B

The variables that are declared outside all functions are called global variable

133. Recursive algorithum are based on

a. Divide and conquer approach

b. Top down approach

c. Bottom up approach

d. Hierarchical approach

134. What do you call the selected keys in the quick sort method?

a. Outer key b. Inner key

c. Pivot key d. Partition key

135. The time complexity in the normal quick sort ,randomized quick sort algorithm
in worst case is

a.O(n2) , O(n log n) b. O(n2) , O(n2)

c. O(n log n), O(n2) d. O(n log n), O(n log n)

136.Let there be an array of length 'N' , and the selection sort algorithms is used to
sort it, How many times a swap function is called to complete the execution?

a. N log N times b. log N times

c. N-1 times d. N times

137.the sorting method which is used for external sort

a. Buuble sort b. Quick sort

c. Merge sort d. Radix sort


138. In analysis of algorithms, approximate relationship between the size of the job
and amount of work required to do is expressed by using.......

a. Central tendency b. Differential equation

c. Order of execution d. Order of magnitude

139. For analyzing an algorithum , which is better computing time?

a. O(100 log N) b. O(N)

c.O(2N) d.O(N log N)

140. Sorting is not possible by using which of the following methods?

a. Insertion b.Selection

c. Deletion d. Exchange

141. What is the type of the algorithm used in solving the 8 Queens problem?

a. Greedy b.Dynamic

c. Backtracking

d. Divide and conquer

142. The asymptotic notation for defining the average time complexity is

a.Equivalent b. Symmetric

c. Reflexive d. Transitive

143. Which of following algorithm scans the list by swapping the entries whenever
pair of adjacent keys are out of desired order?

a. Insertion sort b. Quick sort

c. Radix sort d.Bubble sort

144. The q notation is

a. Symmetric b. Reflexive

c.Transitive d. Both (a),(b) and (c) above

145. Which of the following belongs to the algorithm paradigm?

a. Minimum and Maximum problem

b. Knapsack problem
c. Selection problem

d. Merge sort

146. The method which traverses the array sequentially to locate the given item in
an array is called

a. Ordered search b. linear search

c. Binary Search d. Hash search

147. What would be the total number of moves in Tower of Hanoi when n = 7?

a. 128 b. 127 c. 126 d.256

148. Which of the following versions of merge sort algorithm does uses space
efficiently?

a. Contiguous version

b. Array version

c. Linked version

d. Structure version

149. What is the time taken by the binary search algorithm to search a key ‘k’ in a
sorted array of ‘n’ elements?

a. O(log2 n) b. O(n) c. (n log 2 n) d.O(n2)

150. There are two sorted lists L1 and L2. Their lengths are n1 and n2 respectively.
You are asked to design an algorithm to generate a sorted list L3 from L1 and L2.
That is, for example, if L1=[1,5,30] and L2=[3,6,12,24,43] then
L3=[1,3,5,6,12,24,30,43]. Which of the following methods is the most efficient?

a. Taking elements from L1 one by one, and inserting them into L2 such that the
order of L2 remains unchanged

b. Appending two lists (i.e. join one list's beginning to the other one's end),then
applying quick sort to the appended list

c. Using a merge method that compares two elements at the head of both lists. The
smaller one is then taken out and inserted at the end of L3 while the larger one is
kept its location unchanged. Repeat this until either L1 or L2 is empty.

d. Append two lists and apply Shell sort.

151. Pick the statement(s) which is(are) not true


a. ADT is useful tool for specifying the logical properties of data type

b. While defining the ADT as a mathematical concept, the space efficiency isn’t a
major concern

c. Every ADT can be implemented using any programming language

d. ADT helps us to hide the organization of the data

152. Which of the following information is not saved in the activation record, when
ever a function call is executed?

a. Static and dynamic address links

b. Current depth of recursion

c. Formal parameters

d. Location where the function should return when done

153. Consider using binary search to look for a given value in an array of integers.
Which of the following must be true in order for the search to work?

I.     The values in the array are stored in sorted order.

II.     The array does not contain any duplicate values.

Ill.    The array does not contain any negative values.

a. Only (i) above b. Only (ii) above

c. Both (i) and (ii) above d. Both (i) and(iii) above

154. Which of the following are essential statement types for describing algorithms?

a. Sequential b. Selection c. Repetition d. All the above

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