273
96k

340+ Data Structure and Algorithms (DSA) Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) , Information Technology Engineering (IT) , Electronics and Communication Engineering , Common Topics in Competitive and Entrance exams .

51.

how many vlue can held by an array A(-1…m,1…m)?

A. m
B. m^2
C. m(m+1)
D. m(m+2)
Answer» D. m(m+2)
52.

let x be the adjacency matrix of a graph .G with no self loop.The entries along the principle diagonal of x are

A. all "0"
B. all "1"
C. both 0&1
D. different
Answer» A. all "0"
53.

_______ refers to the operation of finding the location of a given item in a collection of items.

A. sorting
B. searching
C. function
D. complexity
Answer» B. searching
54.

_______ is a field whose values uniquely determine the records in the file.

A. pointer
B. primary key
C. secondary key
D. function
Answer» B. primary key
55.

By using which of the following methods sorting is not possible?

A. insertion
B. exchange
C. selection
D. deletion
Answer» D. deletion
56.

Which is the simplest file structure?

A. sequential
B. indexed
C. random
D. bubble
Answer» A. sequential
57.

A ______ is a data structure use foe a storage of a records.

A. tree
B. hash table
C. stack
D. graph
Answer» B. hash table
58.

_________ is a search for data that uses an index to locate the item.

A. binary search
B. sequential search
C. indexed search
D. jump search
Answer» C. indexed search
59.

If the input array is unsorted, then only a linear ______ can be used.

A. binary search
B. sequential search
C. indexed search
D. jump search
Answer» B. sequential search
60.

_______ is a attribute of a sort, indicating that data with equal keys maintain their relative input order in the output.

A. sort order
B. sort stability
C. sort efficiency
D. collision
Answer» B. sort stability
61.

In ______ method of hashing, selected digit are extracted from the key and used as the address.

A. subtraction
B. digit extraction
C. rotation
D. folding
Answer» B. digit extraction
62.

________ hashing method is used in combination with other methods.

A. subtraction
B. digit extraction
C. rotation
D. division
Answer» C. rotation
63.

If two different keys yield the same hash address, it is called _______ .

A. binary search
B. sequential search
C. collision
D. rotation
Answer» C. collision
64.

The ______ sort algorithm is called diminishing increment sort.

A. merge
B. radix
C. shell
D. selection
Answer» C. shell
65.

A ______ merge sort uses a constant number of input merge files and the same number of output merge files.

A. k-way
B. balanced
C. polyphase
D. radix
Answer» B. balanced
66.

________ method of collision resolution involves maintaining two tables in memory.

A. linear probing
B. chaining
C. quadratic probing
D. double hashing
Answer» B. chaining
67.

_______ is a merge sort that sorts a data stream using repeated merges.

A. balanced
B. polyphase
C. radix
D. k-way
Answer» D. k-way
68.

One of the statement is false

A. tree is an abstract data type
B. array is a linear data structure
C. typedef is derived data type
D. float is built in data type
Answer» C. typedef is derived data type
69.

Examples of sorting algorithms are

A. bubble sort
B. selection sort
C. insertion sort
D. (a),(b),and ©
Answer» D. (a),(b),and ©
70.

Give timing complexities of three sorting algorithms bubble sort,selection sort,insertion sort respectively.

A. 0(log n), 0(log n), o(log n)
B. o(n2), o(n2), o(n2)
C. o(n2), o(n log n), o(n log n)
D. o(n log n), o(n2), o(n log n)
Answer» B. o(n2), o(n2), o(n2)
71.

_____passes are required to sort n data using bubble sort.

A. n
B. n-1
C. n+2
D. n-2
Answer» B. n-1
72.

Best and the worst case timing complexities of insertion sort are_________.

A. o(n2), o(n2)
B. o(n log n), o(n2)
C. o(n), o(n2)
D. o(n), o(n3)
Answer» C. o(n), o(n2)
73.

Which sorting algorithm can exploit the partially sorted data in a list?

A. bubble sort
B. selection sort
C. insertion sort
D. all of them
Answer» C. insertion sort
74.

Sorting is useful for_________

A. report genration
B. minimizing the storage needed
C. making searching easier and efficient
D. responding to queries easily
Answer» C. making searching easier and efficient
75.

The getch() library function returns___

A. a character when any key is pressed
B. a character when enter is pressed
C. displays a character on the screen when any key is pressed
D. none of these
Answer» A. a character when any key is pressed
76.

The function islower(char)checks whether a character is in lower case or not.Therefore it should return______

A. 0 or 1
B. -1, 0 or 1
C. a character
D. nothing
Answer» A. 0 or 1
77.

A variable P is called pointer if__

A. p contains the address of an element in data
B. p points to the address of first element in data
C. p can store only memory address
D. p contain the data and the address of data
Answer» A. p contains the address of an element in data
78.

Which of the following data structure can't store the non-homogeneous data element?

A. arrays
B. records
C. pointers
D. none
Answer» A. arrays
79.

The difference between linear array and a record is_____

A. an array is suitable for homogeneous data but the data items in a record may have different data type
B. in a record,theremay not be a natural ordering in opposed ti linear array
C. a record form a hierarchical structure but a linear array does not
D. all of above
Answer» D. all of above
80.

If s1 is "ABC" and s2 is "DEF" then strcat(s1,s2)will give the following result.

A. s1="abcdef" and s2="def"
B. s1="abcdef" and s2="def"
C. s1="abc" and s2="abcdef"
D. s1="abc" and s2="abcdef"
Answer» A. s1="abcdef" and s2="def"
81.

Give output of the following programint main(){inta[]={2,3,4,5,6};printf("%d",2[a]);}

A. compilation error
B. run time error
C. 4
D. 2
Answer» C. 4
82.

Where do we use the operator --> ?

A. to access a member of structure
B. to access member of union
C. to access an array
D. both(a) and(b).
Answer» D. both(a) and(b).
83.

The function strcmp(s1,s2)will return -1 if____

A. s1>s2
B. s1=s2
C. s1<s2
D. function does not return -1.
Answer» C. s1<s2
84.

Which of the following data structure store the homogeneous data elements?

A. arrays
B. records
C. pointers
D. none
Answer» A. arrays
85.

The number of comparisons required to sort 5 numbers in ascending order using bubble sort are

A. 7
B. 6
C. 10
D. 5
Answer» C. 10
86.

A sorting algorithm is stable if

A. its time complexity is constant irrespective of the nature of input
B. preserves the original order of records with equal keys
C. its space complexity is constant irrespective of the nature of input
D. it sorts any volume of data in a constant time
Answer» B. preserves the original order of records with equal keys
87.

The average case complexity of Insertion Sort is

A. o(2n)
B. o(n3)
C. o(n2)
D. o(2n)
Answer» C. o(n2)
88.

A sorted file contains 16 items. Using binary search, the maximum number of comparisons to search for an item in this file is

A. 15
B. 8
C. 1
D. 4
Answer» D. 4
89.

A sort which compares adjacent elements in a list and switches where necessary is

A. insertion sort
B. heap sort
C. quick sort
D. bubble sort
Answer» D. bubble sort
90.

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

A. insertion sort
B. selection sort
C. heap sort
D. quick sort
Answer» B. selection sort
91.

The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending order, using bubble sort is

A. 11
B. 12
C. 13
D. 14
Answer» D. 14
92.

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

A. stable
B. consistent
C. external
D. linear
Answer» A. stable
93.

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?

A. bubble sort
B. selection sort
C. insertion sort
D. merge sort
Answer» C. insertion sort
94.

Which of the following sorting methods will be the best if number of swappings done, is the only measure of efficienty?

A. bubble sort
B. selection sort
C. insertion sort
D. merge sort
Answer» B. selection sort
95.

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

A. bubble sort
B. selection sort
C. insertion sort
D. merge sort
Answer» A. bubble sort
96.

What is the number of swaps required to sort n elements using selection sort, in the worst case?

A. Θ(n)
B. Θ(n log n)
C. Θ(n2)
D. Θ(n2 log n)
Answer» A. Θ(n)
97.

The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is

A. 6
B. 5
C. 7
D. 8
Answer» B. 5
98.

The smallest element of an array’s index is called its

A. lower bound
B. upper bound
C. range
D. extraction
Answer» A. lower bound
99.

Which of the following sorting methods would be most suitable for sorting a list which is almost sorted

A. bubble sort
B. selection sort
C. insertion sort
D. merge sort
Answer» A. bubble sort
100.

The complexity of Bubble sort algorithm is

A. o(n)
B. o(log n)
C. o(n2)
D. o(n log n)
Answer» C. o(n2)

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.