340+ Data Structure and Algorithms (DSA) Solved MCQs

1.

It exports a set of operations

A. true, false
B. false, true
C. true, true
D. false, false
Answer» C. true, true
2.

A graph is said to be complete if there is no edge between every pair of vertices.

A. true, false, true
B. true, true, false
C. true, true, true
D. false, true, true
Answer» B. true, true, false
3.

Space Complexity iii) Is the strategy guaranteed to find the solution when there in one.

A. a-iii, b-ii, c-i
B. a-i, b-ii, c-iii
C. a-iii, b-i, c-ii
D. a-i, b-iii, c-ii
Answer» C. a-iii, b-i, c-ii
4.

The time complexity of binary search is O(logn).

A. true, false
B. false, true
C. false, false
D. true, true
Answer» D. true, true
5.

A graph is said to be complete if there is an edge between every pair of vertices.

A. true, true
B. false, true
C. false, false
D. true, false
Answer» A. true, true
6.

To find the predecessor, it is required to traverse the list from the first node in case of singly linked list.

A. i-only
B. ii-only
C. both i and ii
D. none of both
Answer» C. both i and ii
7.

Nodes that are not root and not leaf are called as internal nodes.

A. true, true
B. true, false
C. false, true
D. false, false
Answer» C. false, true
8.

A node is child node if out degree is one.

A. true, true
B. true, false
C. false, true
D. false, false
Answer» B. true, false
9.

Insertion b) Deletion c) Retrieval d) Traversal

A. only a,b and c
B. only a and b
C. all of the above
D. none of the above
Answer» D. none of the above
10.

In strictly binary tree, the out-degree of every node is either o or 2.

A. true, false
B. false, true
C. true, true
D. false, false
Answer» C. true, true
11.

The complexity of the average case of an algorithm is

A. much more complicated to analyze than that of worst case
B. much more simpler to analyze than that of worst case
C. sometimes more complicated and some other times simpler than that of worst case
D. none or above
Answer» A. much more complicated to analyze than that of worst case
12.

The Average case occur in linear search algorithm

A. when item is somewhere in the middle of the array
B. when item is not in the array at all
C. when item is the last element in the array
D. when item is the last element in the array or is not there at all
Answer» A. when item is somewhere in the middle of the array
13.

Which of the following case does not exist in complexity theory

A. best case
B. worst case
C. average case
D. null case
Answer» D. null case
14.

The space factor when determining the efficiency of algorithm is measured by

A. counting the maximum memory needed by the algorithm
B. counting the minimum memory needed by the algorithm
C. counting the average memory needed by the algorithm
D. counting the maximum disk space needed by the algorithm
Answer» A. counting the maximum memory needed by the algorithm
15.

The time factor when determining the efficiency of algorithm is measured by

A. counting microseconds
B. counting the number of key operations
C. counting the number of statements
D. counting the kilobytes of algorithm
Answer» B. counting the number of key operations
16.

Two main measures for the efficiency of an algorithm are

A. processor and memory
B. complexity and capacity
C. time and space
D. data and space
Answer» C. time and space
17.

Computers are used for processing numerical data called _______ data.

A. float
B. local
C. character
D. non-local
Answer» C. character
18.

Each programming language contains a ______ set that is used to communicate with the computer.

A. character
B. integer
C. float
D. numeric
Answer» A. character
19.

Finite sequence S of zero or more characters is called _______.

A. array
B. list
C. string
D. block
Answer» C. string
20.

String with zero characters is called ________ string.

A. null
B. binary
C. totalled
D. list
Answer» A. null
21.

A computer which can access an individual byte is called a ________ machine.

A. memory addressable
B. byte addressable
C. bit
D. byte
Answer» B. byte addressable
22.

Groups of consecutive elements in a string, such as words, phrases and sentences are called ________.

A. main strings
B. substring
C. index
D. block
Answer» B. substring
23.

The number of characters in a string is called its ______.

A. length
B. breath
C. width
D. none
Answer» C. width
24.

_________ operation of word processing involves replacing one string in the text by another.

A. insertion
B. deletion
C. searching
D. replacement
Answer» D. replacement
25.

________ is the problem of deciding whether or not a given String pattern P appears in a text T.

A. pattern matching
B. searching
C. sorting
D. deletion
Answer» A. pattern matching
26.

________ is a linearly ordered sequence of memory cells.

A. node
B. link
C. variable
D. null
Answer» A. node
27.

Each node in a linear list contains an item called _______ which points to the next node in the list.

A. node
B. link
C. variable
D. null
Answer» B. link
28.

_______ is a variable whose length may vary during the execution, but the length cannot exceed a maximum values defined before the program is executed.

A. dynamic
B. static
C. semi static
D. global
Answer» C. semi static
29.

In _______ storage, each cell is divided into two parts---- the path stores a single character, while the second part contains the address of the cell containing the next character.

A. fixed length
B. linked list
C. variable length
D. sequential
Answer» B. linked list
30.

If string 1 = John, and string 2 = Rivers are merged, the process is called ----

A. insertion
B. deletion
C. concatenation
D. replacement
Answer» C. concatenation
31.

_____ is a variable whose length may vary during the execution of a program.

A. dynamic
B. static
C. semi static
D. global
Answer» A. dynamic
32.

_______ is a structure used to represent the linear relationship between elements by means of sequential memory locations.

A. linked list
B. array
C. pointer
D. stack
Answer» B. array
33.

A ______ is a list of a finite number of homogeneous data elements.

A. linear array
B. pointer
C. linked list
D. tree
Answer» A. linear array
34.

The number of elements n is called the length or _____ of the array.

A. upper bound
B. lower bound
C. size
D. variable
Answer» C. size
35.

The number K in A[K] is called the subscript or the ________.

A. size
B. index
C. variable
D. constant
Answer» B. index
36.

Which of the following items are not part of the array declaration?

A. name of the array
B. data type of the array
C. index set of the array
D. length of the array
Answer» D. length of the array
37.

Programming languages like FORTRAN and PASCAL allocate memory space for arrays ______.

A. dynamically
B. statically
C. successively
D. alternatively
Answer» B. statically
38.

The process of accessing and processing each element of an array A, exactly once is called _______.

A. deleting
B. inserting
C. traversing
D. searching
Answer» C. traversing
39.

_________ refers to the operations of rearranging the elements of an array A so that they are in increasing order.

A. searching
B. sorting
C. traversing
D. inserting
Answer» B. sorting
40.

Two dimensional arrays are sometimes called _______ arrays.

A. integer
B. boolean
C. matrix
D. real
Answer» C. matrix
41.

________ is a list in which the order of the items is significant, and the items are not necessarily sorted.

A. ordered list
B. indexed list
C. sequential list
D. unordered list
Answer» C. sequential list
42.

Representation of a two dimensional as one single column of rows and mapping it sequentially is called _______ representation.

A. row-major
B. row
C. column-major
D. column
Answer» A. row-major
43.

Matrices with relatively high proportion of zero entries are called ______ matrices.

A. triangular
B. diagonal
C. sparse
D. adjacency
Answer» C. sparse
44.

_______ arrays are where the elements in the different arrays with the same subscript belongs to the same record.

A. one dimensional
B. parallel
C. two dimensional
D. static
Answer» B. parallel
45.

Records can be stored in an area of memory called _______ memory.

A. dynamic
B. static
C. simple
D. parallel
Answer» A. dynamic
46.

A matrix in which non-zero entries can only occur on the diagonal or on elements immediately above or below the diagonal, is called ______ matrix.

A. triangular
B. tridiagonal
C. sparse
D. simple
Answer» C. sparse
47.

Elements of of an arrays are accessed by

A. accessing fuction in built in data structure
B. mathematical fuction
C. index
D. none of the above
Answer» C. index
48.

Array is a

A. index data structure
B. non liturenear data structure
C. complx data structure
D. none of the above
Answer» D. none of the above
49.

Row -major order in two -dimentional array refers to an arrangement where

A. all elements of a row are stored in memory in sequence followed by next row in sequence,and so on
B. all elements of row are stored in memory in sequence followed by next column in sequence ,and so on
C. all elements of row are stored in memory in sequence followed by next column in sequence
D. none of the above
Answer» A. all elements of a row are stored in memory in sequence followed by next row in sequence,and so on
50.

Array is

A. data in physical order
B. data in logical order
C. both a& b
D. none of the above
Answer» A. data in physical order
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» B. records
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)
Tags
Question and answers in Data Structure and Algorithms (DSA), Data Structure and Algorithms (DSA) multiple choice questions and answers, Data Structure and Algorithms (DSA) Important MCQs, Solved MCQs for Data Structure and Algorithms (DSA), Data Structure and Algorithms (DSA) MCQs with answers PDF download