Professional Documents
Culture Documents
DataStructures Q1 070320241053
DataStructures Q1 070320241053
DataStructures Q1 070320241053
A) Value of node B) Address of next node C) Address of previous node D) All of the mentioned
2. What is the optimal time complexity to count the number of nodes in a linked list? [A]
A) Implementing file systems B) Chaining in hash tables C) Binary Trees implementation D) All of the mentioned
4. Insertion of an element at the middle of a linked list requires the modification of how many pointers? [A]
A) 2 B) 1 C) 3 D) 4
5. Insertion of an element at the ends of a linked list requires the modification of how many pointers? [A]
A) 2 B) 1 C) 3 D) 4
6. In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element will be? [B]
7. Which of the following algorithms is not feasible to implement in a linked list? [D]
9. In which type of linked lists traversals can be performed in both directions? [B]
Page No.: 1
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) Singly Linked Lists B) Doubly Linked Lists C) Circular Linked Lists D) None of the mentioned
10. Which type of linked list stores the address of the head node in the next pointer of the last node? [D]
A) Singly Linked List B) Doubly Linked List C) Hashed List D) Circular Linked List
11. Which of the following sorting algorithms is preferred to sort a linked list? [A]
A) delete is a keyword. B) free is a library function. C) Bothdelete is a keyword. and free is D) None of the mentioned
a library function.
14. The type of pointer used to point to the address of the next element in a linked list? [C]
15. A linear collection of data elements where the linear node is given by means of pointer is called? [A]
16. Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, [D]
membership, cardinality will be the slowest?
A) union B) membership C) cardinality D) union, intersection
17. In linked list each node contain minimum of two fields. One field is data field to store the data second field is? [C]
18. The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used? [C]
A) Singly linked list B) Doubly linked list C) Circular doubly linked list D) Array implementation of list
19. A variant of linked list in which last node of the list points to the first node of the list is? [C]
Page No.: 2
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) Singly linked lis B) Doubly linked list C) Circular linked list D) Multiply linked list
A) Only in forward direction B) Only in reverse direction C) In both directions D) None of the mentioned
21. A variant of the linked list in which none of the node contains NULL pointer is? [C]
A) Singly linked list B) Doubly linked list C) Circular linked list D) None of the mentioned
22. In circular linked list, insertion of node requires modification of? [B]
23. Linked lists are not suitable to for the implementation of? [D]
24. In worst case, the number of comparison need to search a singly linked list of length n for a given element is [C]
26. What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of [A]
the list?
A) θ (n) B) O(n) C) O(1) D) θ (1)
27. What would be the asymptotic time complexity to add an element in the linked list? [B]
A) a null pointer B) the previous node C) the rst node in the list D) the last node does not contain a
pointer
29. A doubly linked list keeps track of the next node in the list as well as [D]
Page No.: 3
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) itself B) the head node C) the tail node D) the previous node
30. The __________ of a linked list points to the rst node in the list. [B]
32. In a circular linked list, the last node points to the [C]
33. Which of the following is not a stable sorting algorithm in its typical implementation. [C]
34. Which of the following sorting algorithms in its typical implementation gives best performance when applied on an array which is sorted or [D]
almost sorted (maximum 1 or two elements are misplaced).
A) Quick Sort B) Heap Sort C) Merge Sort D) Insertion Sort
35. What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary search? [C]
A) N B) N*log(N) C) N2 D) N*log(N)2
36. Which is the correct order of the following algorithms with respect to their time Complexity in the best case ? [B]
A) Merge sort > Quick sort >Insertion sort > B) insertion sort < Quick sort < Merge sort C) Merge sort > selection sort > quick D) Merge sort > Quick sort > selection
selection sort < selection sort sort > insertion sort sort > insertion sort
37. Consider the array A[]= {6,4,8,1,3} apply the insertion sort to sort the array . Consider the cost associated with each sort is 25 rupees , what [A]
is the total cost of the insertion sort when element 1 reaches the first position of the array ?
A) 50 B) 25 C) 75 D) 100
38. Which of the following sorting algorithms has the lowest worst-case complexity? [A]
39. Which one of the following in-place sorting algorithms needs the minimum number of swaps? [D]
Page No.: 4
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
41. The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 5, 13 in ascending order, using bubble sort is [D]
A) 11 B) 12 C) 13 D) 10
43. What is the worst-case time complexity of the Bubble sort Algorithm? [C]
44. In the following scenarios, when will you use selection sort? [C]
A) The input is already sorted B) A large file has to be sorted C) Large values need to be sorted with D) Small values need to be sorted with
small keys large keys
45. The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort and selection sort respectively are __________ [A]
47. Consider a situation where swap operation is very costly. Which of the following sorting algorithms should be preferred so that the number [B]
of swap operations are minimized in general?
A) Heap Sort B) Selection Sort C) Insertion Sort D) Merge Sort
48. Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) [B]
operations. The array now looks like this: 16 14 15 10 12 27 28 How many heapify operations have been performed on r
A) 1 B) 2 C) 3 or 4 D) 5 or 6
49. You have to sort 1 GB of data with only 100 MB of available main memory. Which sorting technique will be most appropriate? [B]
Page No.: 5
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
50. Which sorting algorithms is most efficient to sort string consisting of ASCII characters? [D]
51. Which of the following sorting algorithms has the minimum running time complexity in the best and average case? [A]
A) Insertion sort, Quick sort B) Quick sort, Quick sort C) Quick sort, Insertion sort D) Insertion sort, Insertion sort
52. Which sorting algorithm will take the least time when all elements of the input array are identical? Consider typical implementations of [A]
sorting algorithms.
A) Insertion Sort B) Heap sort C) Merge Sort D) Selection sort
53. Which of the following is good for sorting arrays having less than 100 elements? [D]
54. Which of the following real time examples is based on insertion sort? [A]
A) arranging a pack of playing cards B) database scenarios and distributes C) arranging books on a library shelf D) real-time systems
scenarios
55. In C, what are the basic loops required to perform an insertion sort? [C]
56. For the best case input, the running time of an insertion sort algorithm is? [A]
57. Which of the following examples represent the worst case input for an insertion sort? [B]
A) array in sorted order B) array sorted in reverse order C) normal unsorted array D) large array
58. What will be the number of passes to sort the elements using insertion sort? 14,12,16,6,3,10 [B]
A) 6 B) 5 C) 7 D) 1
59. Which of the following operations is performed more efficiently by doubly linked list than by singly linked list? [A]
Page No.: 6
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) Deleting a node whose location in given B) Searching of an unsorted list for a given C) Inverting a node after the node with D) Traversing a list to process each
item given location node
60. What is the maximum number of comparisons that can take place when a bubble sort algorithm is implemented?, suppose there are n [D]
elements in the array.
A) n^2 B) n (n +1) C) n(n-1) D) (n*(n-1))/2
A) Implementation of Stacks and Queues. B) Implementation of Binary Trees. C) Implementation of Data Structures D) All of the mentioned
that can simulate Dynamic Arrays.
62. If new data needs to be added to a linked list, the program simply __________ and inserts it into the series. [A]
A) allocates another node B) removes a node C) borrows a node from the compiler D) None of the mentioned
63. Which of the following statements is true regarding Bubble Sort? [C]
A) It is the fastest sorting algorithm. B) It is suitable for sorting large datasets. C) It is an in-place sorting algorithm. D) It has a time complexity of O(n log n)
in all cases
64. Which sorting algorithm will take least time when all elements of input array are identical? Consider typical implementations of sorting [A]
algorithms.
A) Insertion Sort B) Heap Sort C) Merge Sort D) Selection Sort
65. How many comparisons are needed to sort an array of length 5 if a straight selection sort is used and array is already in the opposite order? [C]
A) 1 B) 5 C) 10 D) 20
66. What is the main drawback of the Bubble Sort algorithm? [C]
A) It is not stable. B) It is not comparison-based. C) It has a high time complexity. D) It is not adaptable to different data
types
A) Uses divide and conquer strategy B) Uses dynamic programming C) Swaps adjacent elements directly D) Only works with integers
A) A programming language B) A collection of algorithms C) A way to store and organize data D) A type of computer hardware
Page No.: 7
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) Index value of an array can be negative B) Elements are sequentially accessed C) Data structure like queue or stack D) There are chances of wastage of
cannot be implemented memory space if elements inserted
in an array are lesser than the
allocated size
71. The data structure required to check whether an expression contains a balanced parenthesis is? [B]
72. Which of the following statement(s) about stack data structure is/are NOT correct? [B]
A) Top of the Stack always contain the new B) Stack is the FIFO data structure C) Null link is present in the last node at D) Linked List are used for
node the bottom of the stack implementing Stacks
73. Which of the following points is/are not true about Linked List data structure when it is compared with an array? [B]
A) Random access is not allowed in a B) Access of elements in linked list takes C) Arrays have better cache locality that D) It is easy to insert and delete
typical implementation of Linked Lists less time than compared to arrays can make them better in terms of elements in Linked List
performance
A) Data structure that compactly stores bits B) Data structure for representing arrays of C) Array in which elements are not D) An array in which most of the
records present in continuous locations elements have the same value
A) Doubly linked list B) Circular linked list C) Singly linked list D) Binary trees
A) int arr[3] = (1,2,3); B) int arr(3) = {1,2,3}; C) int arr[3] = {1,2,3}; D) int arr(3) = (1,2,3);
A) int arr[] = new int(3); B) int arr[]; C) int arr[] = new int[3]; D) * int arr() = new int(3);
Page No.: 8
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) Objects of mixed data types can be B) Elements in an array cannot be sorted C) Index of first element of an array is 1 D) Easier to store elements of same
stored data type
79. Assuming int is of 4bytes, what is the size of int arr[15]; [D]
A) 15 B) 19 C) 11 D) 60
81. Which one of the following is an application of Queue Data Structure? [D]
A) When a resource is shared among B) When data is transferred C) Load Balancing D) All of the mentioned
multiple consumers. asynchronously (data not necessarily
received at same rate as sent) between
two processes
82. The time complexity used for inserting a node in a priority queue on the basis of key is: [A]
83. We can use a self–balancing binary search tree for implementing the: [B]
A) Hash table B) Priority queue C) Heap sort and Priority queue D) Heap sort
84. Assuming int is of 4bytes, what is the size of int arr[15];? [D]
A) 15 B) 19 C) 11 D) 60
85. In general, the index of the first element in an array is __________ [A]
A) 0 B) -1 C) 2 D) 1
A) A parentheses balancing program B) Tracking of local variables at run time C) Compiler Syntax Analyzer D) Data Transfer between two
asynchronous process
Page No.: 9
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
88. To represent hierarchical relationship between elements, which data structure is suitable? [C]
90. Two main measures for the efficiency of an algorithm are [C]
A) Processor and memory B) Complexity and capacity C) Time and space D) Data and space
91. The time factor when determining the efficiency of algorithm is measured by [B]
A) Counting microseconds B) Counting the number of key operations C) Counting the number of statements D) Counting the kilobytes of algorithm
92. The space factor when determining the efficiency of algorithm is measured by [A]
A) Counting the maximum memory needed B) Counting the minimum memory needed C) Counting the average memory D) Counting the maximum disk space
by the algorithm by the algorithm needed by the algorithm needed by the algorithm
93. Which of the following case does not exist in complexity theory [A]
94. The Worst case occur in linear search algorithm when [D]
A) Item is somewhere in the middle of the B) Item is not in the array at all C) Item is the last element in the array D) Item is the last element in the array
array or is not there at all
A) When Item is somewhere in the middle B) When Item is not in the array at all C) When Item is the last element in the D) When Item is the last element in the
of the array array array or is not there at all
A) Much more complicated to analyze than B) Much more simpler to analyze than that C) Sometimes more complicated and D) None of the mentioned
that of worst case of worst case some other times simpler than that
of worst case
Page No.: 10
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
101. from following which is not the operation of data structure? [A]
A) operations that manipulate data in some B) operations that perform computation C) operations that check for syntax D) operations that monitor an object for
way errors the occurance of a controlling event
103. Which of the following abstract data types can be used to represent a many to many relation? [D]
104. A mathematical-model with a collection of operations defined on that model is called [B]
106. An ADT is defined to be a mathematical model of a user-defined type along with the collection of all ____________ operations on that model [C]
107. The information about an array that is used in a program will be stored in [D]
Page No.: 11
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) Merge sort B) Typical in-place quick sort C) Heap sort D) Selection sort
111. Running merge sort on an array of size n which is already sorted is [B]
112. The time complexity of a quick sort algorithm which makes use of median, found by an O(n) algorithm, as pivot element is [B]
A) Takes O(nlogn) times B) Maintains the relative order of C) Uses divide-and-conquer paradigm D) Takes O(n) space
occurrence of non-distinct elements
114. The worst-case occur in linear search algorithm when ……. [D]
A) Item is somewhere in the middle of the B) Item is not in the array at all C) Item is the last element in the array D) Item is the last element in the array
array or item is not there at all
115. If the number of records to be sorted is small, then …… sorting can be efficient. [C]
116. The complexity of the sorting algorithm measures the …… as a function of the number n of items to be sorter. [B]
117. Which of the following is not a limitation of binary search algorithm? [D]
Page No.: 12
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) must use a sorted array B) requirement of sorted array is expensive C) there must be a mechanism to D) binary search algorithm is not
when a lot of insertion and deletions are access middle element directly efficient when the data elements
needed more than 1500.
118. The Average case occurs in the linear search algorithm ……… [A]
A) when the item is somewhere in the B) when the item is not the array at all C) when the item is the last element in D) Item is the last element in the array
middle of the array the array or item is not there at all
A) sorted linked list B) sorted binary trees C) sorted linear array D) pointer array
120. Which of the following is not the required condition for a binary search algorithm? [C]
A) The list must be sorted B) There should be direct access to the C) There must be a mechanism to D) Number values should only be
middle element in any sublist delete and/or insert elements in the present
list.
121. …………order is the best possible for array sorting algorithm which sorts n item. [C]
122. Which if the following is/are the levels of implementation of data structure [D]
123. Identify the data structure which allows deletions at both ends of the list but insertion at only one end. [A]
124. Which matrix has most of the elements (not all) as Zero? [C]
126. Which of the following is not the part of ADT description? [D]
Page No.: 13
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
127. Inserting an item into the stack when stack is not full is called …………. Operation and deletion of item form the stack, when stack is not [A]
empty is called ………..operation.
A) push, pop B) pop, push C) insert, delete D) delete, insert
A) Last in first out B) First in last out C) Last in last out D) First in first out
129. Which of the following data structure can’t store the non-homogeneous data elements? [A]
131. A ……. is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out. [A]
A) Queue linked list B) Stacks linked list C) Both of them D) None of the mentioned
132. A list which displays the relationship of adjacency between elements is said to be [C]
133. …………………….. is a variable that can hold the address of the variables, structure and functions that are used in the program. [B]
134. ……………… is the organization of the data in a computers memory or in a file. [B]
135. Some examples of data structures are i) array ii) stack iii) queuei v) binary tree v) hybrid tree [A]
A) i, ii, iii and iv only B) ii, iii, iv and v only C) i, ii, iii and v only D) All i, ii, iii, iv and v
136. Which data structure allows deleting data elements from and inserting at rear? [B]
Page No.: 14
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) A data structure that shows a B) Container of objects of similar types C) Arrays are immutable once initialised D) Array is not a data structure
hierarchical behavior
138. Which of the following concepts make extensive use of arrays? [D]
A) Data structure like queue or stack cannot B) There are chances of wastage of C) Elements are sequentially accessed D) None of the mentioned
be implemented memory space if elements inserted in
an array are lesser than the allocated
size
140. Is O(n) the Worst case Time Complexity for addition of two Sparse Matrix? [B]
141. Which of the following is not the method to represent Sparse Matrix? [D]
143. In a stack, if a user tries to remove an element from an empty stack it is called _________ [A]
144. Pushing an element into stack already having five elements and stack size of 5, then stack becomes ___________ [A]
Page No.: 15
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
147. Adding a derived class to a base class requires fundamental changes to the base class [B]
A) the bitwise OR operator (|) B) the logical OR operator (||) C) the bitwise AND operator (&) D) the logical AND operator (&&)
150. To expose a data member to the program, you must declare the data member in the _____ section of the class [C]
152. Which of the following are valid characters for a numeric literal constant? [D]
A) a comma B) a dollar sign ($) C) a percent sign (%) D) None of the mentioned
153. A function that changes the state of the cout object is called a(n) _____ [C]
154. When the compiler cannot differentiate between two overloaded constructors, they are called [C]
155. Some Streams work with input, and some with output [A]
156. If you design a class that needs special initialization tasks, you will want to design a(n) _____ [C]
157. Which type of statement does not occur in computer programs? [C]
Page No.: 16
Subject Name & Code : Data Structures ( 23PC204B ) Exam Name : Q1
A) pair of parentheses B) pair of curly braces C) control string D) None of the mentioned
A) functions that return only a single value B) #include files C) inheritance D) All of the mentioned
Page No.: 17