Saturday, October 27, 2007

Linear Search Interview Questions Part 1


1.The sequential search, also known as the linear search.

2.Every element in the data set is examined in the order presented until the value being searched for is found, the following technique is called as
a. Binary search.
b. Quick search.
c. Linear search.
d. None of these.
Ans:c

3.Best case time complexity of Sequential search is
a. O(1)
b. O(n)
c. O(n×n)
d. None of these.
Ans:a
4.Average case time complexity of Sequential search is
e. O(1)
f. O(n)
g. O(n×n)
h. None of these.
Ans:b
5. Worst case time complexity of Sequential search is
i. O(1)
j. O(n)
k. O(n×n)
l. None of these.
Ans:b
6. Best case time complexity of linear search is
m. O(1)
n. O(n)
o. O(n×n)
p. None of these.
Ans:a
7.Average case time complexity of Linear search is
q. O(1)
r. O(n)
s. O(n×n)
t. None of these.
Ans:b
8.Worst case time complexity of Linear search is
u. O(1)
v. O(n)
w. O(n×n)
x. None of these.
Ans:b
9. Efficiency is usually measured in terms of abstract computations, such as data moves and the memory used. True.

10.Sorting is the process of putting items in a predetermined order, such as increasing or decreasing order.


11.The simplest form of search is …
y. Binary search
z. Linear search
aa. Both
bb. None of these
Ans:b

12.Linear search is applicable to a table organized in
cc. Array
dd. Linked list
ee. Tree
ff. None of these
Ans:a,b
13.Sequential search is applicable to a table organized in
gg. Array
hh. Linked list
ii. Tree
jj. None of these
kk. Ans:a,b

14.The algorithm for sequential search is…
ll. for(i=0;iif (key != k (i))
return (i);
return (-1);
mm. for(i=0;iif (key == k (i))
return (i);
return (-1);
nn. None of these
oo. All of these
Ans:b

15.An efficient linear search method involves inserting the argument key at the end of the array before beginning the search, thus guaranteeing that the key will be found. The algorithm for this is …
pp. for(i=0;iif (key == k (i))
return (i);
return (-1);
qq. k(n) = key;
for (i=0;key != k(i);i++);
if( ireturn( i );
else
return (-1);
rr. None of these
ss. All of these
Ans:b

16.The efficiency of searching a list is ___________ by adding a sentinel node containing the argument key at the end of the list.
tt. Decreased
uu. Improved (as the for loop condition is simplified “k(p) != key”)
vv. None of these
ww. All of these
Ans:b

17.An efficient linear search method involves inserting the argument key at the end of the array before beginning the search, thus guaranteeing that the key will be found. The extra key inserted at the end of the array is called as
xx. Metical
yy. Sentinel
zz. Ultimo
aaa. All of these
Ans:b

18.The sentinel method of linear search requires an…
bbb. Additional external pointer
ccc. Additional internal pointer
ddd. None of these
eee. All of these
Ans:a
19.Linear search is a kind of _____________ .
Ans. search

20.Transpose sequential search is a kind of ___________
fff. linear search
ggg. binary search
hhh. sequential search
iii. none of the above
Ans:a,c
21._______________ is a part of or used in linear search.
Ans. move-to-front heuristic.

22.______________ is a part of or used in sequential search.
Ans. move-to-front heuristic.

0 comments:

Advertisement

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com