|
1:
|
The time complexity of linear
search algorithm over an array of n elements is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation : |
|||||||
|
2:
|
The time required to search an
element in a linked list of length n is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation : |
|
3:
|
The worst case time required to
search a given element in a sorted linked list of length n is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
|
4:
|
Which of the following sorting
algorithms does not have a worst case running time of O(n2)?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation : |
|
5:
|
For a linear search in an array of
n elements the time complexity for best, worst and average case are .......,
....... and ........ respectively
|
|||||||
|
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/1.html#ixzz2fUPEvw53
|
6:
|
The average time required to
perform a successful sequential search for an element in an array A(1 :
n) is given by
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
7:
|
Using the standard algorithm, what
is the time required to determine that a number n is prime ?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
8:
|
The average time required to
perform a successful sequential search for an element in an array A (1 :
n) is given by
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
9:
|
Which of the following is false ?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D Explanation : |
|
10:
|
A search begins the search with
the element that is located in the middle of the array
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D |
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/2.html#ixzz2fUPNWaik
|
11:
|
To sort many large object or
structures, it would be most efficient to
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
|
12:
|
To sort many large objects or
structures, it would be most eficient to place
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation : |
|
13:
|
A matrix "a" is called
lower triangular if and only if for all j > ai j = 0. If
such a matrix is to be sorted in a one dimensional array, A then ai
j could be mapped to which of the following index of A ?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
14:
|
Average successful search time for
sequential search on 'n' items is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation :
If search key matches the very
first item, with one comparison we can terminate. If it is
second, two comparisons, etc.
Average =[ n (n + 1) ]
/ 2
|
|
15:
|
The average search time of
hashing, with linear probing will be less if the load factor
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation :
Load factor is the ratio of number
of records that are currently present and the total number of records that
can be present. If the load factor is less, free space will be more. This
means probability of collision is less. So, search time will be less.
|
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/3.html#ixzz2fUPVl655
|
16:
|
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
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
|
17:
|
Which of the following
sorting procedure is the slowest ?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D Explanation : |
|
18:
|
Which of the following
sorting method is stable ?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
19:
|
Which of the following best
describes sorting ?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
|
20:
|
A sort which compares adjacent
elements in a list and switches where necessary is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D |
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/4.html#ixzz2fUPd59UT
|
21:
|
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
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation : |
|
22:
|
Which of the following
statements is used in the binary search algorithm to halve the array ?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
23:
|
The data for which you are
searching is called
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
24:
|
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?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
|
25:
|
Which of the following is false ?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/5.html#ixzz2fUPl4rOc
|
26:
|
The number of possible comutative
binary operations that can be defined on a set of n elements (for a given n)
is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
|
27:
|
The number of swappings needed to
sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending order, using bubble
sort is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D Explanation : |
|
28:
|
The average successful search time
taken by binary search on a sorted array of 10 items is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D Explanation :
The 10 items i1, i2, ..., i10 may
be arranged in a binary search trees as in Fig To get i5, the number
of comparision needed is 1; for i2, it is 2; for i8 it is 2; for i1 it is 3,
and so on. The average is (1+(2+2) +(3+3+3+3)+(4+4+4))/10, i.e., 2.9.
|
|
29:
|
The average successful search time
for sequential search on 'n' items is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation :
If the search key matches the very
first item, with one ocmparision we can terminate. If it is second, two
comparisons , etc. So, average is (1+2+...+n)/n .i.e. (n+1)/2
|
|
30:
|
The running time of an algorithm
T(n), where 'n' is the input size, is given by
T(n) = 8T(n/2) + qn, if n>1
Where p,q are constants. The order
of this algorithm is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/6.html#ixzz2fUPtX7qk
|
31:
|
L:et m, n be positive integers.
Define Q (m, n) as
Q (m, n) = 0, if m>n
Then Q (m, 3) is (a div b, gives
the quotient when a is divided by b)
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation :
Let m>n. Let m/n yield a
quotient x and remainder y. So, m= n*x+y and y<m div 3 is the quotient
when m is divided by 3. So, that many times p is added, before we terminate
recursion by satisfying the end condition Q (m,n) = 0 if m<n. Hence the
result.
|
|
32:
|
Sorting is useful for
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D Explanation : |
|
33:
|
Choose the correct statements
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D Explanation : |
|
34:
|
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
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
35:
|
The way a card game player
arranges his cards as he picks them up one by one, is an example of
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/7.html#ixzz2fUQJUWL0
|
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?
|
||||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
|
37:
|
Which of the following sorting
methods will be the best if number of swappings done, is the only measure of
efficienty?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation : |
|
38:
|
You are asked to sort 15 randomly
generated numbers. You should prefer
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
39:
|
As part of the 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
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation : |
|
40:
|
The maximum number of comparisons
needed to sort 7 items using radix sort is (assume each item is 4 digit
decimal number)
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation :
The maximum number of comparison
is number of items ´ radix ´ number of digits i.e., 7´10´4 = 280.
|
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/8.html#ixzz2fUQcUfhq
|
41:
|
Which of the following algorithms
exhibits the unnatural behavior that, minimum number of comparisons are
needed if the list to be sorted is in the reverse sorted order and maximum
number of comparisons are needed if they are already in sorted order?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation : |
|
42:
|
Which of the following sorting
algorithm has the worst time complexity of nlog(n)?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
43:
|
Which of the following sorting
methods sorts a given set of items that is already in sorted order or in
reverse sorted order with equal speed?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation : |
|
44:
|
The order of the binary search
algorithm is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option D Explanation :
Let there be ‘n’ items to be
searched, After the first search the list is divided into two, each of length
n/2. After the next search, 2 liss, each of length n/4 and so on. This
successive division has to stop when the length of lists becomes 1. Let it
happen after k steps. After the k steps, n/2k=1. Solving, k = log2n.
Hence the order is log(n).
|
|
45:
|
Merge sort uses
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/9.html#ixzz2fUQjPmt6
|
46:
|
To store details of an employee, a
storage space of 100 characters is needed. A magentic tape with a density of
1000 characters per inch and an inter-record gap of 1 inch is used to store
information about all employees in the company. What should be the blocking
factor so that the wastage does not exceed one-third of the tape?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation :
Blocking factor is the number of
logical records that is packed to one physical record. Here in every 3 inch,
there should be 2 inch of information. Hence 2´ 10 = 20 logical records.
|
|
47:
|
A machine needs a minimum of 100
sec to sort 1000 names by quick sort. The minimum time needed to sort 100
names will be approximately
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation :
In the best case, quick sort
algorithm makes nlog(n) comparisons. So 1000´log (1000) = 9000 comparisons,
which takes 100s. To sort 100 names a minimum of 100 (log 100) = 600
comparisons are needed. The takes 100´600/9000= 6.7s.
|
|
48:
|
A machine took 200 see to sort 200
names, using bubble sort. In 800 sec, it can approximately sort
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A 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.
|
|
49:
|
Which of the following is useful
in implementing quick sort?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
|
50:
|
The recurrence relation that
arises in relation with the complexity of binary search is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation : |
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/10.html#ixzz2fUQrjDq6
|
51:
|
Assume 5 buffer pages are
available to sort a file of 105 pages. The cost of sorting using m-way merge
sort is
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option C Explanation :
In the first pass we can create
[105/5] = 21 sorted sub-files, each 5 pages long. In the second pass by 4-way
merging (4 because one of the 5 available buffers has to be reserved for
holding the output), one can create [21/4] = 6 sorted sub-files, each 20
pages long (except the last). Again applying 4-way merge sort, we get create
[6/4] = 2 sorted sub-files. These two can be merged to get the final sorted
file. We need a total of 4 passes. Total cost will be 2 x 105 x 4 = 840
units.
|
|
52:
|
What is the number of swaps
required to sort n elements using selection sort, in the worst case?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option A Explanation :
Note that we are concerned about
the swaps, not the comparisons. In the best case, there is no need for any
swap. The best case scenario is when the given list of elements is already in
sorted order. In the worst case, we need (n-1) swaps. For example, consider
the list 10, 5, 6, 7, 8, 9. We need 5 swaps. To conclude, 0 ≤ (the number of
required swaps) < n
|
|
53:
|
In quick sort, for sorting n
elements, the (n/4)th smallest element is selected as pivot using
an Θ(n) time algorithm. What is the worst case time complexity of the quick
sort?
|
|||||||
|
||||||||
|
|
Answer
& Explanation
Answer: Option B Explanation :
If the list is evenly split at
each and every step, the recursion depth will be log n, and the (worst) time
complexity will be n log n. In the given scenario, the recursion depth cannot
be greater than 2 log n. So the (worst) time complexity will still be bound
by n log n.
|
Read more: http://www.avatto.com/computer/exam/mcqs/data-structure/questions/15/11.html#ixzz2fUQzlZdS
No comments:
Post a Comment