1) 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 item is not there at all
2) If the number of records
to be sorted is small, then …… sorting can be efficient.
A. Merge
B. Heap
C. Selection
D. Bubble
3) The complexity of sorting
algorithm measures the …… as a function of the number n of items to be sorter.
A. average time
B. running time
C. average-case complexity
D. case-complexity
4) 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 more than 1500.
5) The Average case occurs
in linear search algorithm ……….
A. when item is somewhere in
the middle of the array
B. when item is not the
array at all
C. when item is the last
element in the array
D. Item is the last element
in the array or item is not there at all
6) Binary search algorithm
cannot be applied to …
A. sorted linked list
B. sorted binary trees
C. sorted linear array
D. pointer array
7) Complexity of linear
search algorithm is ………
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)
8) Sorting algorithm can be
characterized as ……
A. Simple algorithm which
require the order of n2 comparisons to sort n items.
B. Sophisticated algorithms
that require the O(nlog2n) comparisons to sort items.
C. Both of the above
D. None of the above
9) The complexity of bubble
sort algorithm is …..
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)
10) State True or False for
internal sorting algorithms.
i) Internal sorting are
applied when the entire collection if data to be sorted is small enough that
the sorting can take place within main memory.
ii) The time required to
read or write is considered to be significant in evaluating the performance of
internal sorting.
A. i-True, ii-True
B. i-True, ii-False
C. i-False, ii-True
D. i-False, ii-False
11) The complexity of merge
sort algorithm is ……
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)
12) ………. is putting an
element in the appropriate place in a sorted list yields a larger sorted order
list.
A. Insertion
B. Extraction
C. Selection
D. Distribution
13) …………order is the best
possible for array sorting algorithm which sorts n item.
A. O(n logn)
B. O(n2)
C. O(n+logn)
D. O(logn)
14) ……… is rearranging pairs
of elements which are out of order, until no such pairs remain.
A. Insertion
B. Exchange
C. Selection
D. Distribution
15) ………… is the method used
by card sorter.
A. Radix sort
B. Insertion
C. Heap
D. Quick
16) Which of the following
sorting algorithm is of divide and conquer type?
A. Bubble sort
B. Insertion sort
C. Merge sort
D. Selection sort
17) …….. sorting algorithm
is frequently used when n is small where n is total number of elements.
A. Heap
B. Insertion
C. Bubble
D. Quick
18) Which of the following
sorting algorithm is of priority queue sorting type?
A. Bubble sort
B. Insertion sort
C. Merge sort
D. Selection sort
19) 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 sub list
C. There must be mechanism
to delete and/or insert elements in list.
D. Number values should only
be present
20) Partition and exchange
sort is ……..
A. quick sort
B. tree sort
C. heap sort
D. bubble sort
ANSWERS:
1) D. Item is the last
element in the array or ..
2) C. Selection
3) B. running time
4) D. binary search algorithm
is not efficient ..
5) A. when item is somewhere
in the middle ..
6) A. sorted linked list
7) A. O(n)
8) C. Both of the above
9) C. O(n2)
10) B. i-True, ii-False
11) D. O(n logn)
12) A. Insertion
13) C. O(n+logn)
14) B. Exchange
15) A. Radix sort
16) C. Merge sort
17) B. Insertion
18) D. Selection sort
19) C. There must be
mechanism to delete ..
20) A. quick sort
worst case algorithm occurs when -------------- Data are random
-----------------------------------------------------------------------worst case algorithm occurs when -------------- Data are random
Examples
The
following computer algorithms are based on divide-and-conquerprogramming
approach −
Merge Sort
Quick Sort
Binary Search
Strassen's Matrix Multiplication
Closest pair (points)
1. Process of inserting an element in stack is called ____________
a) Create
b) Push
c) Evaluation
d) Pop
View Answer
Answer: b
Explanation: Push operation allows users to insert elements in stack. If stack is filled completely and trying to perform push operation stack – overflow can happen.
2. Process of removing an element from stack is called __________
a) Create
b) Push
c) Evaluation
d) Pop
View Answer
Answer: d
Explanation: Elements in stack are removed using pop operation. Pop operation removes the top most element in the stack i.e. last entered element.
3. In a stack, if a user tries to remove an element from empty stack it is called _________
a) Underflow
b) Empty collection
c) Overflow
d) Garbage Collection
View Answer
Answer: a
Explanation: Underflow occurs when the user performs a pop operation on an empty stack. Overflow occurs when the stack is full and the user performs a push operation. Garbage Collection is used to recover the memory occupied by objects that are no longer used.
4. Pushing an element into stack already having five elements and stack size of 5, then stack becomes
a) Overflow
b) Crash
c) Underflow
d) User flow
View Answer
Answer: a
Explanation: The stack is filled with 5 elements and pushing one more element causes a stack overflow. This results in overwriting memory, code and loss of unsaved work on the computer.
No comments:
Post a Comment