Data Structure
Data Structure
Data Structure
2. A binary tree whose every node has either zero or two children is called:
a. Extended Binary Tree b. Binary Search Tree
c. None of the Above d. Complete Binary Tree
5. 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. e d b g f c a b. e d b f c a
c. d e b f g c a d. d e f b c a
7. 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 3 additions
d. 3 deletions and 2 additions
9. The way a card game player arranges his cards as he picks them up one by one, is an example of
a. bubble sort b. merge sort c. insertion sort d. selection sort
10. 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(1) b. O(n log n) c. O(log n) d. O(n)
15. 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
16. 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;
};
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;
while(head!=NULL){
n=head->next;
delete head;
head=n;
}
21. The recurrence relation that arises in relation with the complexity of binary search is
a. T(n)=T(n/2)+k, where k is constant
b. T(n)=2T(n/2)+k, where k is constant
c. T(n)=T(n/2)+log(n)
d. T(n)=T(n/2)+n
22. The running time T(n), where `n' is the input size of a recursive algorithm is given as followsT(n)=c+T(n-1),if n>1
3
Shriram Mantri Vidyanidhi Info Tech Academy
Data structure Question Bank
d, if n≤ 1
The order of this algorithm is
a. n2 b. n c. n3 d. nn
30. Each item in the list contains a �link� to structure containing the _ _ _ _ _ _ _ item
a.previous b.next c.present d.last
33. Linked lists are not suitable for data structures of which one of the following problem?
a.insertion sort b.Binary search c.radix sort d.polynomial manipulation problem
34. An item that is read as input can be either pushed to a stack and latter popped and printed, or printed directly.
Which of the following will be the output if the input is the sequence of items-1,2,3,4,5?
a.3,4,5,1,2 b.3,4,5,2,1 c.1,5,2,3,4 d.5,4,3,1,2
36. LIFO is
a.stack b. queue c.linked list d. tree
37. Which of the following programming languages features require a stack-base allocation
a.pointer b.Block-structure c.recursion d.dynamic scoping
39. Which of the following is essential for converting an infix expression to postfix form efficiently?
a.An operator stack b. An operand stack c.An operator stack and an operand stack d. A parse tree
40. A queue of characters currently contained a,b,c,d. What would be the contents of queue after the following
operationDELETE, ADD W, ADD X, DELETE, ADD Y
a.A,B,C,W,Y b.C,D,W,X,Y c.W,Y,X,C,D d.A,B,C,D,W
41. A circular queue of size N will sign queue full when the number of elements in the queue is
a.N-1 b. N c.N+1 d. N-2
42. The postfix expression for the infix expressionA + B* (C+D) / F + D*E is:
a.AB + CD + F / D + E* b.ABCD + * F / + DE* c.A*B + CD / F*DE ++ d.A+ BCD / F* DE ++
43. The performance of an algorithm is specified by the following notation that represents the worst case
a.O-notation b. Omega notation c.Theta notation d. alpha-notation
47. To insert a node at the end of the doubly linked list _ _ _ _ _ _ _ no. of pointers to be manipulated
a.1 b.2 c.3 d.4
48. To delete an item in the middle of a circular doubly linked list, _ _ _ _ _ _ _ _ no.of points to be manipulated
5
Shriram Mantri Vidyanidhi Info Tech Academy
Data structure Question Bank
a.2 b.4 c.6 d.8
49. If storage class is missing in the array definition, by default it will be taken to be
a.automatic b.external c.static d.either automatic or external depending on the place of ccurrence
51. The maximum number of comparisons needed to sort 7 items using radix sort is (assume each item is a 4 digit
decimal number)
a.280 b. 40 c.47 d. 38
52. You are asked 15 randomly generated numbers. You should prefer
a.bubble sort b. quick sort c.merge sort d. heap sort
53. The time required to search an element in a binary search tree having n elements is
a.O(1) b.O(log2 n) c.O(n) d.O(n log2 n)
54. A binary tree T has n leaf nodes. The number of nodes of degree 2 in T is
a.log2 n b.n-1 c.n d.2n
55. A tree, for which at every node the height of its left sub tree and right sub tree differ at most by one is a/an
a.Binary search tree b.AVL tree c.Complete binary tree d.Threaded binary tree
56. Which of the following sorting algorithms does not have a worst case running time complexity of O(n2)?
a.Insertion sort b.Merge sort c.Quick sort d.Bubble sort
58. There are 4 different algorithms A1,A2,A3,A4 to solve a given problem with the order
log(n),log(log(n)),nlog(n),n/log(n) respectively. Which is the best algorithm?
a.A1 b.A2 c.A3 d.A4
59. Which of the following sorting algorithm has the worst time complexity of nlog(n)?
a.Heap sort b. Quick sort c.Insertion sort d. Selection sort