Vidyanidhi Info Tech Academy: PG DAC Question Bank
Vidyanidhi Info Tech Academy: PG DAC Question Bank
Q2. Deleting a node in a linked list is a simple matter of using the delete operator to free the node’s memory
a) True b) False
Q4. Which one of the following algorithm is NOT an example of Divide and conquer technique
a) Quick Sort b) Merge Sort c) Bubble Sort d) Binary Search
Q5. The inorder traversal of some binary tree produces the sequence DBEAFC, and the postorder transversal of the
same tree produced the sequence DEBFCA. Which of the following is correct preorder transversal sequence?
a) DBAECF b) ABEDFC c) ABDECF d) None of the above
Q11. The end at which a new element gets added to queue is called
a) Front b) Rear c) Top d) Bottom
Q15. The inorder traversal of some binary tree produces the sequence DBEAFC, and the postorder
traversal of the same tree produced the sequence DEBFCA. Which of the following is a correct
preorder traversal sequence?
a) DBAECF b) ABEDFC c) ABDECF d) None of the above
Q16. Which of the following is not an operation of queue, assuming that queue has items `Q` and `X`?
a) empty(Q) b) deque(Q,X) c) enque(Q,X) d) push(Q,X)
Q18. A dynamic data structure where we can search for desired records in O(log2n) time is
a) heap b) binary search tree c) circularly linked list d) array
Q20. The five items: A, B, C, D and E are pushed in a stack, one after the other starting from A. The stack is popped
four times and each element is inserted in a queue. Then two elements are deleted from the queue and pushed
back on the stack. Now one item is popped from the stack. The popped item is.
a) A b) B c) C d) D
Q22. The memory address of fifth element of an array can be calculated by the formula
a. LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array
b. LOC(Array[5])=Base(Array[5])+(5-lower bound), where w is the number of words per memory cell for the array
c. LOC(Array[5])=Base(Array[4])+(5-Upper bound), where w is the number of words per memory cell for the array
d. None of above
Q24. Which of the following is not the required condition for binary search algorithm?
a) The list must be sorted
b) there should be the direct access to the middle element in any sublist
c)There must be mechanism to delete and/or insert elements in list
d) none of above
Q28. Which of the following data structure can't store the non-homogeneous data elements?
a) Arrays b) Records c) Pointers d) None
Q30. Each data item in a record may be a group item composed of sub-items; those items which are
indecomposable are called
a) elementary items b) atoms c) scalars d) all of above
Q34. When new data are to be inserted into a data structure, but there is no available space; this situation is usually
called
a) underflow b) overflow c) housefull d) saturated
3
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q37. Which of the following is two way list?
a) grounded header list b) circular header list
c) linked list with header and trailer nodes d) none of above
Q39. A data structure where elements can be added or removed at either end but not in the middle
a) Linked lists b) Stacks c) Queues d) Deque
Q40. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return
a) FAEKCDBHG b) FAEKCDHGB c) EAFKHDCBG d) FEAKDCHBG
Q41. Which data structure allows deleting data elements from front and inserting at rear?
a) Stacks b) Queues c) Deques d) Binary search tree
Q42. Identify the data structure which allows deletions at both ends of the list but insertion at only one end.
a) Input-restricted deque b) Output-restricted deque c) Priority queues d) None of above
Q45. To represent hierarchical relationship between elements, which data structure is suitable?
a) Deque b) Priority c) Tree d) All of above
Q46. A binary tree whose every node has either zero or two children is called
a) Complete binary tree b) Binary search tree c) Extended binary tree d) None of above
Q48. When representing any algebraic expression E which uses only binary operations in a 2-tree,
a) the variable in E will appear as external nodes and operations in internal nodes
b) the operations in E will appear as external nodes and variables in internal nodes
c) the variables and operations in E will appear only in internal nodes
d) the variables and operations in E will appear only in external nodes
4
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q50. When converting binary tree into extended binary tree, all the original nodes in binary tree are
a) internal nodes on extended tree b) external nodes on extended tree
c) vanished on extended tree d) None of above
Q51. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal
a) ABFCDE b) ADBFEC c) ABDECF d) ABDCEF
Q54. In a binary tree, certain null entries are replaced by special pointers which point to nodes higher in the tree for
efficiency. These special pointers are called
a) Leaf b) branch c) path d) thread
Q55. The in order traversal of tree will yield a sorted listing of elements of tree in
a) Binary trees b) Binary search trees c) Heaps d) None of above
Q62. 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
5
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q63. 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
Q64. Which of the following case does not exist in complexity theory
a) Best case b) Worst case c) Average case d) Null case
Q72. The indirect change of the values of a variable in one module by another module is called
a) internal change b) inter-module change c) side effect d) side-module update
Q73. Which of the following data structure is not linear data structure?
a) Arrays b) Linked lists c) Both of above d) None of above
6
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q75. The operation of processing each element in the list is known as
a) Sorting b) Merging c) Inserting d) Traversal
Q80. Each array declaration need not give, implicitly or explicitly, the information about
a) the name of array b) the data type of array
c) the first data from the set to be stored d) the index set of the array
Q81. The elements of an array are stored successively in memory cells because
a) by this way computer can keep track only the address of the first element and the addresses of other
elements can be calculated
b) the architecture of computer memory does not allow arrays to store other than serially
c) both of above
d) none of above
Q83. Which of the following statement is true regarding stacks and queue?
i) In sequential representation, stack is logically as well as physically full
ii) Linear queue result in memory wastage as reuse of memory is not allowed.
iii) A Queue-full condition for a circular queue is ‘rear=front + 1’
a) i & ii b) i & iii c) ii & iii d) All.
Q84. Queue-full condition for the circular queue represented sequentially is?
a) front = = rear b) rear + 1 + front c) (rear+1)%arraysize = = front d) None of the these
Q88. Which of the following is not true regarding a singly linked list?
a) Nodes are linked in one direction
b) The last node is pointing to NULL indicating the end of list
c) Searching for a node always starts at the first node and traverses through every subsequent nodes
d) Address of the list is the address of the node
Q89. The header of main function which takes command line arguments looks like ___________
a) Int main(int argc, char *argv) b) Int main(char *argv, int argc)
c) Int main(int argc, char *argv[]) d) Int main(char *argv[],int argc)
Q90. Using which macro, we can display the argument from variable number of argument function?
a) va_arg b) va_list c) va_show d) va_start
Q93. A program P reads in 500 integers in the range [0 to 100] representing the score of 500 students. It then prints
the frequency of each score above 50. What would be the best way for P to store the frequencies?
a) An array of 50 numbers b) An array of 100 numbers
c) An array of 500 numbers d) A dynamically allocated array of 550 numbers
Q99. Which out of the given function types cannot be declared “virtual”?
a) Normal member functions b) Constructor c) Destructor d) None of the above
9
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q101. Static_cast can be applied at __________
a) Compile time b) runtime c) linking time d) both a and b
Q104. Which of the following STL Container will store the elements in adjacent memory locations?
a) Vector b) list c) set d) map
Q107. In which operator overloading, compiler implicitly passes a dummy integer as an argument?
a) Post increment / decrement operator b) Pre increment / decrement operator
c) Both the above d) None of the above
10
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q111. What is the primary purpose of template function?
a) To allow a single function to be used with varying types of arguments
b) To hide the name of the function from the linker (preventing duplicate symbols)
c) To improve execution speed of the program
d) To enable better debugging
Q112. Which of the following data structure may give overflow error, even though the current number of element
in it is less than its size?
a) Simple queue b) Circular queue c) Primary queue d) Stack
a) a=1 b=2 c=3 b) a=3 b=1 c=2 c) a=3 b=2 c=1 d) a=2 b=3 c=1
Q114. In a binary tree, certain null entries are replaced by special pointers which point to nodes higher in the tree
for efficiency. These special pointers are called ______
a) root b) node c) branch d) thread
Q115. a binary search tree whose left subtree and right subtree differ in height by at most one unit is called.
a) AVL tree b) Red-black tree c) Lemma tree d) None of the above
Q117. Which of the following stack operations could result in stack underflow?
a) Push b) pop c) is_full d) none of the above
Q118. Which of the following sorting algorithm has the worst time complexity of nlog(n)?
a) Heap sort b) Insertion sort c) Selection sort d) Bucket sort
Q119. The number of binary trees with 3 nodes which when traversed in post order gives the sequence A, B , C is
a) 3 b) 5 c) 7 d) 9
Q120. A binary tree that has n leaf nodes, all at same level. The number of non-leaf nodes in such tree is
a) n-1 b) log(n) c) 2n d) 2n-1
11
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q123. Which design pattern you would use to limit the class instantiation to one object?
a) Factory method design pattern b) Builder design pattern
c) Prototype design pattern d) Singleton design pattern
Q124. The object which outlives the program execution time and exists between executions of the program is
known as______________________
a) Global object b) persistent object c) transient object d) delegate object
Q125. Which design pattern you would use to translate an existing class interface into a compatible target
interface?
a) Proxy design pattern b) Adapter design pattern
c) Façade design pattern d) Bridge design pattern
Q126. The adapter, bridge and composite design patterns are examples of _________
a) Creational pattern b) Structural pattern
c) Behavioral pattern d) Interaction pattern
Q127. Communication diagram, sequence diagram and timing diagram can all be categorized as _________
a) Behavior diagram b) Structure diagram c) Activity diagram d) Interaction diagram
Q129. Deleting a node in a linked list is a simple matter of using the delete operator to free the node’s memory
a) True b) False
Q131. Which one of the following algorithm is NOT an example of Divide and conquer technique
a) Quick Sort b) Merge Sort c) Bubble Sort d) Binary Search
Q132. The inorder traversal of some binary tree produces the sequence DBEAFC, and the postorder transversal of
the same tree produced the sequence DEBFCA. Which of the following is correct preorder transversal sequence?
a) DBAECF b) ABEDFC c) ABDECF d) None of the above
Q138. The end at which a new element gets added to queue is called
a) Front b) Rear c) Top d) Bottom
Q139. If we traverse a following tree in Pre order then what will be traversal
a) ABDGCEHIF b) ABDGHEICF c) ABDGFCIEH d) None of the above
Q142. The inorder traversal of some binary tree produces the sequence DBEAFC, and the postorder traversal of the
same tree produced the sequence DEBFCA. Which of the following is a correct preorder traversal sequence?
a) DBAECF b) ABEDFC c) ABDECF d) None of the above
Q146. A dynamic data structure where we can search for desired records in O(log2n) time is
a) heap b) binary search tree c) circularly linked list d) array
Q148. Deleting a node in a linked list is a simple matter of using the delete operator to free the node’s memory.
a) True b) False
Q149. The inorder traversal of some binary tree produces the sequence DBEAFC, and the postorder traversal of the
same tree produced the sequence DEBFCA. Which of the following is a correct preorder traversal sequence?
a) DBAECF b) ABEDFC c) ABDECF d) None of the above
Q152. Suppose the numbers 6, 4, 2,9,5,7,0,3,1 are inserted in that order into an initially empty binary search tree.
The binary search tree uses the usual ordering on natural numbers. What is the inorder traversal sequence of the
resultant tree?
Select one:
a) 7 9 6 1 0 3 2 5 4 b) 1 0 3 2 5 4 7 9 6 c) 7 9 0 1 2 3 4 5 6 d) 0 1 2 3 4 5 6 7 9
Q155. 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
Q156. 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
14
Vidyanidhi Info Tech Academy
PG DAC Question Bank
c) Counting the average memory needed by the algorithm
d) Counting the maximum disk space needed by the algorithm
Q157. Which of the following case does not exist in complexity theory
a) Best case b) Worst case c) Average case d) Null case
Q160. The correct order of the efficiency of the following sorting algorithms according to their overall running
time comparisons is
a) bubble>selection>insertion b) Insertion>selection>bubble
c) Merge=Quick=Heap d) none above
Q161. 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) quick sort b) selection sort
Q162. The way a card game player arranges his cards as he picks them one by one can be compared to
a) Quick sort b) Insertion sort c) Selection sort d) Merge sort
Q163. Which among the following is the best when the list is already sorted
a) Merge sort b) Quick sort c) Insertion sort d) Selection sort
Q167. An ADT is defined to be a mathematical model of a user-defined type along with the collection of all
____________ operations on that model.
a) Cardinality b) Assignment c) Primitive d) Structured
Q168. An algorithm is made up of two independent time complexities f (n) and g (n). Then the complexities of the
algorithm is in the order of
a) f(n) x g(n) b) Max ( f(n),g(n)) c) Min (f(n),g(n)) d) f(n) + g(n)
Q169. As part of the maintenance work, you are entrusted with the work of rearranging the library books in a shelf
in proper order, at the end of each day. The ideal choice will be
a) Bubble sort b) Quick sort c) Insertion sort d) Selection sort
15
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q170.The running time of merge sort can be recursively represented by
a) T(n)=2T(n/4)+n b) T(n)=2T(n/2)+n c) T(n)=2T(n/2)+2 d) T(n)=2T(n/3)+n
Q171.You have a sorted array and now you are given an element to be placed in that array so that the resulting
array is also sorted, the best sorting technique in this case is
a) Bubble sort b) Selection sort c) Insertion sort d) Merge sort
Q172. The input to a merge sort is 6,5,4,3,2,1 and the same input is applied to quick sort then which is the best
algorithm in this case
a) Merge sort b) Quick sort c) Cannot be decided
Q173. The memory available for storage is less, in this case if you want to sort the data which is the better approach
amongst the following
a) Merge sort b) Quick sort c) Heap sort d) All
Q174. Arrange heap sort, merge sort and quick sort in the order of their space complexity
a) heap>merge>quick b) quick<heap<merge c) merge>quick>heap d) none
Q175. One of the reason why quick sort is better compared to other sorts is
a) its running time is O(n) b) its space complexity is theta(log n),
Q178. Which of the following statements are right about radix sort?
a) LSD radix sort is a stable sort b) MSD radix sort is a stable sort c) None.
Q179. LSD radix sort is applied on the following set of numbers: 21,86,124,33,29,163. What will be the order of
numbers just before the MSD is considered?
a. (21,29,86,33,124,163) b. ( 21,124,29,33,163,86) c. ( 21,29,124,163,33,86)
Q180. The worst case time and worst case space complexity of radix sort is:
a) O(k*lg (N)) b) O(N^2) c) O(k*N)
Q184. Each array declaration need not give, implicitly or explicitly, the information about
a) The name of array b) The data type of array
c) The first data from the set to be stored d) The index set of the array
Q186. Which of the following is not the required condition for binary search algorithm?
a) The list must be sorted, there should be the direct access to the middle element in any sub list
b) There must be mechanism to delete and/or insert elements in list
c) none of above
Q189. The extra key inserted at the end of the array is called a,
a) End key. b) Stop key. c) Sentinel. D) Transposition.
Q192. When new data are to be inserted into a data structure, but there is no available space; this situation is
usually called
a) underflow b) overflow c) house full d) saturated
17
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q195. A data structure where elements can be added or removed at either end but not in the middle
a) Linked lists b) Stacks c) Queues d) Deque
Q196. Identify the data structure which allows deletions at both ends of the list but insertion at only one end.
a) Input-restricted deque b) Output-restricted deque
c) Priority queues d) None of above
Q202. The link field in the last node of the linked list contains
a) Zero value b) link to the first node
c) Pointer to the next element location d) all above
Q203. To delete a node at the beginning of the list, the location of the list is modified as the address of the.
a) second element in the list b) first element in the list
c) last element in the list d) no element
Q204. A linked list in which the last node points to the first is called a
a) Doubly linked list b) Circular list c) Generalized list d) reveres list
Q206. In the linked list representation of the stacks, the top of the stack is represented by
a) the last node b) any of the nodes c) first node d) non above
Q210. To represent hierarchical relationship between elements, which data structure is suitable?
a) Deque b) Priority c) Tree d) All of above
Q212. When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return
a) FAEKCDBHG b) FAEKCDHGB c) EAFKHDCBG d) FEAKDCHBG
Q213. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal
a) ABFCDE b) ADBFEC c) ABDECF d) ABDCEF
Q214. In a binary tree, certain null entries are replaced by special pointers which point to nodes higher in the tree
for efficiency. These special pointers are called
a) Leaf b) branch c) path d) thread
Q215. The in order traversal of tree will yield a sorted listing of elements of tree in
a) Binary trees b) Binary search trees c) Heaps d) None of above
Q221. The node which gives rise to the branch node is called the
a) ancestor b) grandfather c) root node
19
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q223. A binary tree in which every non-leaf node has non-empty right and left subtrees is said to be a
a) Strictly binary tree b) complete binary tree c) almost complete binary tree
Q225. In the sequential representation of binary tree implementation each node of the tree will have
a) no link field
b) info, left, right and father fields
c) three fields, data and the pointers to left and right subtrees.
Q227. In Breadth First Search of Graph, which of the following data structure is used?
a) Stack. b) Queue. c) Linked List. d) None of the above.
Q228. The binary tree in which the descendent points to the ancestor is called?
a) linked tree b) threaded tree c) pointer tree
Q229. A binary tree whose every node has either zero or two children is called:
a) Complete Binary Tree b) Binary Search Tree
c) None of the Above d) Extended Binary Tree
20
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Q232. The initial configuration of the queue is a, b, c, d (a is the front end).To get the configuration d, c, b, a one
needs a minimum of?
a) 2 deletions and 3 additions b) 3 deletions and 4 additions
c) 3 deletions and 2 additions d) 3 deletions and 3 additions
Q233. What is the infix version of the following postfix expression? X12+z17Y +42*/+
a) x+12+z/ (17+y)*42 b) x+12+z ((17+y)*42
c) x+12+z/17+y*42 d) x+12+z)/ (17+Y*42)
Q236. Suppose we have the following class whose underlying data structure is a linked list of of
List nodes.
class List{
public:
//other public functions
~List();
private:
struct Listnode{
int item;
List node *next;
};
ListNode*head;
};
Q237. Which of the following sequence of code could be used in the destructor~List () to correctly delete all of the
nodes in the list? (Which ones are legal, even if the style is atrocious?)
I. for(ListNode*n=head;head!=NULL;head=n){
n=head->next;
delete head;
}
III. ListNode*n;
Q238. while(head!=NULL){
n=head->next;
delete head;
21
Vidyanidhi Info Tech Academy
PG DAC Question Bank
head=n;
}
a) I and II only b) III only c) II and III only d) and III only
Q240. The numbers of swapping needed to sort the numbers 25,23,21,22,24 in ascending order using bubble sort
is:
a) 12 b) 20 c) 6 d) 13
Q241. What is the expected time required to search for a value in a binary search tree containing n nodes? (You
should make reasonable assumptions about the structure of the tree.)
a) O(log n) b) O(n) c) O(1) d) O(n log n)
Q242. The inorder and preorder traversal of a binary tree are a b c a f c e g and a b d e c f g, Respectively. The
postorder traversal of the binary tree is :
a) d e b f g c a b) e d b g f c a c) e d b f c a d) d e f b c a
Q245. Assume the objects of type short, float and long occupy 2 byte, 4 byte and 8 byte respectively. The memory
requirement for variable t ignoring alignment considerations is
a) 14 byte b) 22 byte c) 18byte d) 10byte
int i;
char*art [] = {“C”,”C++”,”JAVA”,”VBA”};
char *(*ptr)[4] = &arr;
char<<++ (*ptr) [2];
return 0;
}
a) Java b) C++ c) ava d) compile time error
23