Home
MCQS
Data structure MCQ Quiz Hub
Data Structure and Algorithms (DSA) set 2
Choose a topic to test your knowledge and improve your Data structure skills
1. how many vlue can held by an array A(-1…m,1…m)?
m
m^2
m(m+1)
m(m+2)
2. let x be the adjacency matrix of a graph .G with no self loop.The entries along the principle diagonal of x are
all "0"
all "1"
both 0&1
different
3. __ refers to the operation of finding the location of a given item in a collection of items.
sorting
searching
function
complexity
4. ______ is a field whose values uniquely determine the records in the file.
pointer
primary key
secondary key
function
5. By using which of the following methods sorting is not possible?
insertion
exchange
selection
deletion
6. Which is the simplest file structure?
sequential
indexed
random
bubble
7. A ______ is a data structure use foe a storage of a records.
tree
hash table
stack
graph
8. _____ is a search for data that uses an index to locate the item.
binary search
sequential search
indexed search
jump search
9. If the input array is unsorted, then only a linear ______ can be used.
binary search
sequential search
indexed search
jump search
10. ____ is a attribute of a sort, indicating that data with equal keys maintain their relative input order in the output.
sort order
sort stability
sort efficiency
collision
11. In ______ method of hashing, selected digit are extracted from the key and used as the address.
subtraction
digit extraction
rotation
folding
12. _____ hashing method is used in combination with other methods.
subtraction
digit extraction
rotation
division
13. If two different keys yield the same hash address, it is called _______ .
binary search
sequential search
collision
rotation
14. The ______ sort algorithm is called diminishing increment sort.
merge
radix
shell
selection
15. A ______ merge sort uses a constant number of input merge files and the same number of output merge files.
k-way
balanced
polyphase
radix
16. ___ method of collision resolution involves maintaining two tables in memory.
linear probing
chaining
quadratic probing
double hashing
17. ____ is a merge sort that sorts a data stream using repeated merges.
balanced
polyphase
radix
k-way
18. One of the statement is false
A. tree is an abstract data type
array is a linear data structure
typedef is derived data type
float is built in data type
19. Examples of sorting algorithms are
bubble sort
selection sort
insertion sort
(a),(b),and ©
20. Give timing complexities of three sorting algorithms bubble sort,selection sort,insertion sort respectively.
0(log n), 0(log n), o(log n)
o(n2), o(n2), o(n2)
o(n2), o(n log n), o(n log n)
o(n log n), o(n2), o(n log n)
21. __passes are required to sort n data using bubble sort.
n
n-1
n+2
n-2
22. Best and the worst case timing complexities of insertion sort are_________.
A. o(n2), o(n2)
o(n log n), o(n2)
o(n), o(n2)
o(n), o(n3)
23. Which sorting algorithm can exploit the partially sorted data in a list?
bubble sort
selection sort
insertion sort
all of them
24. Sorting is useful for_________
report genration
minimizing the storage needed
making searching easier and efficient
responding to queries easily
25. The getch() library function returns___
a character when any key is pressed
a character when enter is pressed
displays a character on the screen when any key is pressed
None of these
26. a character when enter is pressed
0 or 1
-1, 0 or 1
a character
nothing
27. A variable P is called pointer if__ A.
p contains the address of an element in data
p points to the address of first element in data
p can store only memory address
p contain the data and the address of data
28. Which of the following data structure can't store the non-homogeneous data element?
arrays
records
pointers
none
29. The difference between linear array and a record is_____
an array is suitable for homogeneous data but the data items in a record may have different data type
. in a record,theremay not be a natural ordering in opposed ti linear array
a record form a hierarchical structure but a linear array does not
All of the above
30. If s1 is "ABC" and s2 is "DEF" then strcat(s1,s2)will give the following result.
s1="abcdef" and s2="def"
s1="abcdef" and s2="def"
s1="abc" and s2="abcdef"
s1="abc" and s2="abcdef"
31. Give output of the following programint main(){inta[]={2,3,4,5,6};printf("%d",2[a]);}
compilation error
run time error
4
2
32. Where do we use the operator --> ?
to access a member of structure
to access member of union
to access an array
both(a) and(b).
33. The function strcmp(s1,s2)will return -1 if____
s1>s2
s1=s2
s1<s2
function does not return -1.
34. The number of comparisons required to sort 5 numbers in ascending order using bubble sort are
7
6
10
5
35. A sorting algorithm is stable if
its time complexity is constant irrespective of the nature of input
preserves the original order of records with equal keys
its space complexity is constant irrespective of the nature of input
it sorts any volume of data in a constant time
36. The average case complexity of Insertion Sort is
o(2n)
o(n3)
o(n2)
o(2n)
37. A sorted file contains 16 items. Using binary search, the maximum number of comparisons to search for an item in this file is
15
8
1
4
38. A sort which compares adjacent elements in a list and switches where necessary is
insertion sort.
heap sort
quick sort
bubble sort
39. 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
insertion sort
selection sort
heap sort
quick sort
40. The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending order, using bubble sort is
11
12
13
14
41. 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
. stable
consistent
external
linear
42. 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?
bubble sort
selection sort
insertion sort
merge sort
43. Which of the following sorting methods will be the best if number of swappings done, is the only measure of efficienty?
bubble sort B. C. D. merge sort
selection sort
insertion sort
insertion sort
44. You are asked to sort 15 randomly generated numbers. You should prefer
bubble sort
selection sort
insertion sort
merge sort
45. What is the number of swaps required to sort n elements using selection sort, in the worst case?
Θ(n)
Θ(n log n)
Θ(n2)
Θ(n2 log n)
46. The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is
6
5
7
8
47. The smallest element of an array’s index is called its
lower bound
upper bound
range
extraction
48. Which of the following sorting methods would be most suitable for sorting a list which is almost sorted
bubble sort
selection sort
insertion sort
merge sort
49. . A sort which compares adjacent elements in a list and switches wherever necessary is _______
insertion sort
bubble sort
selection sort
none of these
50. Which of the following sorting method is the slowest?
o(1)
o(log2n)
o(n)
o(n2)
51. In bubble sort,for a file of size n,after p iterations number of records in proper position is____
n-p
n-p+1
n-p+2
p
52. In bubble sort,for a file of size n,during each pth pass the number of last records left out are___
n-p
n-p+1
p
p-1
53. Given a file size n the number of times a given file is passed through in bubble sort is____
n2
n-1
nlogn
logn
54. Total number of comparision in bubble sort is____
o(nlogn)
o(n2)
o(n)
None of These
55. The selection sort is basically a method of repeated
interchange
searching
position adjustment
None of These
Submit