Thursday, 1 December 2011

Data structures Objective Questions And Answers : Set-1


OBJECTIVE TYPE QUESTIONS :
Q. B Trees are generally
(A) very deep and narrow (B) very wide and shallow
(C) very deep and very wide (D) cannot say
Ans:D
Q. A technique for direct search is
(A) Binary Search (B) Linear Search
(C) Tree Search (D) Hashing
Ans:D
Q. If a node having two children is deleted from a binary tree, it is replaced by its
(A) Inorder predecessor (B) Inorder successor
(C) Preorder predecessor (D) None of the above
Ans:B
Q. The searching technique that takes O (1) time to find a data is
(A) Linear Search (B) Binary Search
(C) Hashing (D) Tree Search
Ans:C
Q. A mathematical-model with a collection of operations defined on that model is called
(A) Data Structure (B) Abstract Data Type
(C) Primitive Data Type (D) Algorithm
Ans:B
Q. 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
Ans:B
Q. The postfix form of the expression (A+ B)*(C*D− E)*F / G is
(A) AB+ CD*E − FG /** (B) AB + CD* E − F **G /
(C) AB + CD* E − *F *G / (D) AB + CDE * − * F *G /
Ans: A
Q. If h is any hashing function and is used to hash n keys in to a table of size m, where n<=m, the expected number of collisions involving a particular key x is :
(A) less than 1. (B) less than n.
(C) less than m. (D) less than n/2.
Ans:A
Q. Let A be an adjacency matrix of a graph G. The th ij entry in the matrix K A , gives
(A) The number of paths of length K from vertex Vi to vertex Vj.
(B) Shortest path of K edges from vertex Vi to vertex Vj.
(C) Length of a Eulerian path from vertex Vi to vertex Vj.
(D) Length of a Hamiltonian cycle from vertex Vi to vertex Vj.
Ans:B
Q. The OS of a computer may periodically collect all the free memory space to form contiguous
block of free space. This is called
(A) Concatenation (B) Garbage collection
(C) Collision (D) Dynamic Memory Allocation
Ans:B
Q. What is the following code segment doing?
void fn( ){
char c;
cin.get(c);
if (c != ‘\n’) {
fn( );
cout.put(c);
}
}
(A) The string entered is printed as it is.
(B) The string entered is printed in reverse order.
(C) It will go in an infinite loop.
(D) It will print an empty line.
Ans:B
Q.You have to sort a list L consisting of a sorted list followed by a few “random” elements.
Which of the following sorting methods would be especially suitable for such a task?
(A) Bubble sort (B) Selection sort
(C) Quick sort (D) Insertion sort
Ans:D
Q. The complexity of multiplying two matrices of order m*n and n*p is
(A) mnp (B) mp
(C) mn (D) np
Ans:A
Q.14 Merging 4 sorted files containing 50, 10, 25 and 15 records will take____time
(A) O (100) (B) O (200)
(C) O (175) (D) O (125)
Ans:A
Q. For an undirected graph with n vertices and e edges, the sum of the degree of each vertex is
equal to
(A) 2n (B) (2n-1)/2
(C) 2e (D) e2/2
Ans:C
Q.16 In worst case Quick Sort has order
(A) O (n log n) (B) O (n2/2)
(C) O (log n) (D) O (n2/4)
Ans:B
Q. A full binary tree with 2n+1 nodes contain
(A) n leaf nodes (B) n non-leaf nodes
(C) n-1 leaf nodes (D) n-1 non-leaf nodes
Ans:B
Q. If a node in a BST has two children, then its inorder predecessor has
(A) no left child (B) no right child
(C) two children (D) no child
Ans:B
Q. A binary tree in which if all its levels except possibly the last, have the maximum number of
nodes and all the nodes at the last level appear as far left as possible, is known as
(A) full binary tree. (B) AVL tree.
(C) threaded tree. (D) complete binary tree.
Ans:A
Q. A linear list of elements in which deletion can be done from one end (front) and insertion
can take place only at the other end (rear) is known as a
(A) queue. (B) stack.
(C) tree. (D) linked list.
Ans:A

No comments:

Post a Comment

Post a Comment