Nothing Special   »   [go: up one dir, main page]

Data Structure and Algorithms (Set 1)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Data Structure and Algorithms (DSA)

1 of 4 sets

1. It exports a set of operations


A. true, false
B. false, true
C. true, true
D. false, false
Answer:C

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
o m
C. true, true, true
. c
D. false, true, true
te
Answer:B a
q M
c
3. Space Complexity iii) Is the strategy guaranteed to find the solution when there
in one.
A. a-iii, b-ii, c-i
M
B. a-i, b-ii, c-iii
C. a-iii, b-i, c-ii
D. a-i, b-iii, c-ii
Answer:C

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


A. true, false
B. false, true
C. false, false
D. true, true
Answer:D

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

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

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

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

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

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


A. true, false

View all MCQ's at McqMate.com


B. false, true
C. true, true
D. false, false
Answer:C

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

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

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

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

15. The time factor when determining the efficiency of algorithm is measured by
A. counting microseconds

View all MCQ's at McqMate.com


B. counting the number of key operations
C. counting the number of statements
D. counting the kilobytes of algorithm
Answer:B

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

17. Computers are used for processing numerical data called _______ data.
A. float
B. local
C. character
D. non-local
Answer:C

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

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


A. array
B. list
C. string
D. block
Answer:C

20. String with zero characters is called ________ string.


A. null

View all MCQ's at McqMate.com


B. binary
C. totalled
D. list
Answer:A

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

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

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


A. length
B. breath
C. width
D. none
Answer:C

24. _________ operation of word processing involves replacing one string in the
text by another.
A. insertion
B. deletion
C. searching
D. replacement
Answer:D

View all MCQ's at McqMate.com


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

26. ________ is a linearly ordered sequence of memory cells.


A. node
B. link
C. variable
D. null
Answer:A

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

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

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

View all MCQ's at McqMate.com


C. variable length
D. sequential
Answer:B

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

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

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

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

34. The number of elements n is called the length or _____ of the array.
A. upper bound
B. lower bound

View all MCQ's at McqMate.com


C. size
D. variable
Answer:C

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


A. size
B. index
C. variable
D. constant
Answer:B

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

37. Programming languages like FORTRAN and PASCAL allocate memory space
for arrays ______.
A. dynamically
B. statically
C. successively
D. alternatively
Answer:B

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

39. _________ refers to the operations of rearranging the elements of an array A so


that they are in increasing order.

View all MCQ's at McqMate.com


A. searching
B. sorting
C. traversing
D. inserting
Answer:B

40. Two dimensional arrays are sometimes called _______ arrays.


A. integer
B. boolean
C. matrix
D. real
Answer:C

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

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

43. Matrices with relatively high proportion of zero entries are called ______
matrices.
A. triangular
B. diagonal
C. sparse
D. adjacency
Answer:C

View all MCQ's at McqMate.com


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

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


A. dynamic
B. static
C. simple
D. parallel
Answer:A

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

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

48. Array is a
A. index data structure
B. non liturenear data structure
C. complx data structure
D. none of the above

View all MCQ's at McqMate.com


Answer:D

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

50. Array is
A. data in physical order
B. data in logical order
C. both a& b
D. none of the above
Answer:A

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

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

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

View all MCQ's at McqMate.com


B. searching
C. function
D. complexity
Answer:B

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

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


A. insertion
B. exchange
C. selection
D. deletion
Answer:D

56. Which is the simplest file structure?


A. sequential
B. indexed
C. random
D. bubble
Answer:A

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


A. tree
B. hash table
C. stack
D. graph
Answer:B

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

View all MCQ's at McqMate.com


B. sequential search
C. indexed search
D. jump search
Answer:C

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

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

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

62. ________ hashing method is used in combination with other methods.


A. subtraction
B. digit extraction
C. rotation
D. division
Answer:C

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

View all MCQ's at McqMate.com


A. binary search
B. sequential search
C. collision
D. rotation
Answer:C

64. The ______ sort algorithm is called diminishing increment sort.


A. merge
B. radix
C. shell
D. selection
Answer:C

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

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


memory.
A. linear probing
B. chaining
C. quadratic probing
D. double hashing
Answer:B

67. _______ is a merge sort that sorts a data stream using repeated merges.
A. balanced
B. polyphase
C. radix
D. k-way
Answer:D

View all MCQ's at McqMate.com


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

69. Examples of sorting algorithms are


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

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

71. _____passes are required to sort n data using bubble sort.


A. n
B. n-1
C. n+2
D. n-2
Answer:B

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

View all MCQ's at McqMate.com


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

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

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

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

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

View all MCQ's at McqMate.com


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

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

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

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

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).

View all MCQ's at McqMate.com


Answer:D

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

84. Which of the following data structure store the homogeneous data elements?
A. arrays
B. records
C. pointers
D. none
Answer:B

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

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

87. The average case complexity of Insertion Sort is


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

View all MCQ's at McqMate.com


Answer:C

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

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

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

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

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

View all MCQ's at McqMate.com


A. stable
B. consistent
C. external
D. linear
Answer:A

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

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

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

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

View all MCQ's at McqMate.com


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

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


A. lower bound
B. upper bound
C. range
D. extraction
Answer:A

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

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

View all MCQ's at McqMate.com

You might also like