Showing posts with label Data Structure. Show all posts
Showing posts with label Data Structure. Show all posts

Data Structure Objective Type Questions And Answers

Data structure multiple choice questions and answers with explanation.
1) The average search time of hashing with linear probing will be less if the load factor  ?
  1. is far less than one
  2. equals one
  3. is far greater than one
  4. None of above
Show/Hide Answer
Answer = A 
Explanation: No Explanation
2) The complexity of binary search algorithm is ?
  1. n
  2. nlogn
  3. logn
  4. n2
Show/Hide Answer
Answer = D 
Explanation:N/A
3) The postfix equivalent of the prefix * + ab - cd is ?
  1. ab + cd - *
  2. abcd + - *
  3. ab + cd * -
  4. ab + - cd *
Show/Hide Answer
Answer = A
Explanation: No Explanation
4)The linked list implementation of sparse matrices is superior to the generalized dope vector method because it is?
  1. Conceptually easier
  2. Completely dynamic 
  3. Efficient in accessing an entry
  4. Efficient if the sparse matrix is a band matrix
  5. A and B
Show/Hide Answer
Answer = E 
Explanation: N/A
5) Sparse matrix have ?
  1. many zero entries
  2. many non-zero entries
  3. higher dimension
  4. none of above
Show/Hide Answer
Answer = A 
Explanation: A sparse matrix is a matrix populated primarily with zeros
6) Which of the following algorithm solves the all pair shortest path problem ?
  1. Dijkstra's algorithm
  2. Floyd's algorithm
  3. Prim's algorithm
  4. Warshall's algorithm
Show/Hide Answer
Answer = B 
Explanation: The Floyd–Warshall algorithm (also known as Floyd's algorithm, Roy–Warshall algorithm, Roy–Floyd algorithm, or the WFI algorithm) is a graph analysis algorithm for finding shortest paths in a weighted graph (with positive or negative edge weights) and also for finding transitive closure of a relation R.

7) As part of 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 ?
  1. Bubble sort
  2. Insertion sort
  3. Selection sort
  4. Heap sort
Show/Hide Answer
Answer = B 
Explanation:N/A

8) The way a card game player arranges his cards as he picks them  up one by one, is an example of ?
  1. bubble sort
  2. selection sort
  3. insertion sort
  4. merge sort
Show/Hide Answer
Answer = C 
Explanation: He scans throught the rest of the cards and pick the one with least value and places it next to the point till which he has already sorted the cards
9) The average successful search time for sequential search on 'n' items is ?
  1. n/2
  2. (n - 1)/2
  3. (n + 2)/2
  4. log(n) + 1
Show/Hide Answer
Answer = C 
Explanation:N/A
10) Linked lists are suitable for which of the following problems ?
  1. Insertion sort
  2. Binary search
  3. Radix sort
  4. Polynomial manipulation
Show/Hide Answer
Answer = B 
Explanation: Through Linked list binary search can be performed efficiently.
read more...

Data Structure Multiple Choice Questions And Answers - Set 2

Data Structure Multiple choice and objective type questions.

1) If the sequence of operations - push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop are performed on a stack, the sequence of popped out values are ?
  1. 2, 2, 1, 1, 2
  2. 2, 2, 1, 2, 2
  3. 2, 1, 2, 2, 1
  4. 2, 1, 2, 2, 2
Show/Hide Answer
Answer = A
Explanation:
The elements are popped from the top of the stack.
2) Queue can be used to implement ?
  1. radix sort
  2. quick sort
  3. recursion
  4. depth first search
Show/Hide Answer
Answer = A 
Explanation:
A simple version of an LSD radix sort can be achieved using queues as buckets.
3) A machine took 200 sec to sort 200 names, using bubble sort. In 800 sec, it can approximately sort ?
  1. 400 names
  2. 800 names
  3. 750 names
  4. 800 names
Show/Hide Answer
Answer = A
Explanation:
For sorting 200 names bubble sort makes 200 x 199/2 = 19900 comparisons. The time needed for 1 comparison is 200 sec. In 800 sec it can make 80,000 comparisons. We have to fine n, such that n(n - 1)/2 = 80,000. From this n is approximately 400.
4) A machine needs a minimum of 100 sec to sort 1000 names by quick sort.The minimum time needed to sort 100 names will be approximately ?
  1. 50.2 sec
  2. 6.7 sec
  3. 72.7 sec
  4. 11.2 sec
Show/Hide Answer
Answer = B 
Explanation:
In the best case quick sort algorithm makes n log(n) comparisons. so 1000 x log (1000) = 9000 comparisons, which takes 100 sec. To sort 100 names a minimum of 100 log(100) = 600 comparisons are needed. This takes 100 x 600/9000 = 6.7 sec.
5) The number of binary trees with 3 nodes which when traversed in post order gives the sequence A,B,C is ?
  1. 3
  2. 9
  3. 7
  4. 5
Show/Hide Answer
Answer =  D
Explanation: Five trees are
6) The average search time of hashing with linear probing will be less if the load factor ?
  1. is far less than one
  2. equals one
  3. is far greater than one
  4. none of above
Show/Hide Answer
Answer = A
Explanation:
Load factor is the ratio number of records that are currently present and the total number of records that can be present. If the load factor is less, free space will be more. This means probability of collision is less. So the search time will be less.
7)  A binary tree that has n leaf nodes. The number of nodes of degree 2 in this tree is ?
  1. log2n
  2. n - 1
  3. n
  4. 2n
Show/Hide Answer
Answer = B
Explanation:
It can be proved by induction that a binary tree with n leaf nodes will have total of 2n - 1 nodes. So number of non-leaf nodes is (2n - 1)-n=n-1
8) The principal of locality justifies the use of ?
  1. Interrupts
  2. DMA
  3. Polling
  4. Cache memory
Show/Hide Answer
Answer = D
Explanation:
In principal of phenomenon the same value or same memory location is being used frequently.
9) Sparse matrices have ?
  1. many zero entries
  2. many non- zero entries
  3. higher dimension
  4. none of above
Show/Hide Answer
Answer = A Explanation: A sparse matrix is a matrix populated primarily with zeros
10) The postfix expression for * + a b - c d is?
  1. ab + cd - *
  2. ab cd + - *
  3. ab + cd * -
  4. ab + - cd *
Show/Hide Answer
Answer = A
Explanation:
No Explanation
read more...

Multiple Choice Questions On Data Structure | UGC NET Exam 2012 Sample

1)What is Data Structure ?
  1. Way to organize data
  2. Accessing of data elements in specified manner
  3. Organization of mathematical and logical concepts
  4. All of Above
Show/Hide Answer
Answer = D 
Explanation:A Data Structure may be organized in different ways : The logical or mathematical model of a particular organization of data is called Data Structure.

2) Which operation is not possible on Data Structure ?
  1. Traversing
  2. Insertion
  3. Reading
  4. Deletion
Show/Hide Answer
Answer = C 
Explanation:Possible operations on the Data Structure are Traversing, Insertion, Searching and Deletion.

3) The memory address of the first element is called ?
  1. Floor Address
  2. Foundation Address
  3. First Address
  4. Base Address
Show/Hide Answer
Answer = D 
Explanation:The memory address of the first element is often called base address in Data Structure.

4) The value of first linked list address is ?
  1. 0
  2. -1
  3. 1
  4. None of Above
Show/Hide Answer
Answer = 0 
Explanation: No explanation for this question.

5) Two dimensional arrays are also called ?
  1. Matrix Array
  2. Table Array
  3. Both a and b
  4. None of the Above
Show/Hide Answer
Answer = C 
Explanation:Two dimensional arrays are called as matrix array and table arrays because they contains rows and columns.

6) The situation in linked list START=NULL is called ?
  1. Overflow
  2. Underflow
  3. Both of above
  4. None of Above
Show/Hide Answer
Answer = B 
Explanation:It is the situation when we are trying to delete an item from the empty linked list.

7) Length of the linear array can be found by using the formula ?
  1. UB - LB + 1
  2. LB + UB
  3. LB - UB
  4. LB - UB + 1
Show/Hide Answer
Answer = A 
Explanation:The length of linear array can be found by using UB - LB + 1 Where UB is upper Bound, LB is Lower Bound of the array.
8) The restriction while using the binary search is ?
  1. List should be small in number
  2. List should be large in number
  3. List should be sorted
  4. No restriction
Show/Hide Answer
Answer = C 
Explanation: Binary search can be applied to a list only if the list is  either in ascending or descending order.

9) The terms PUSH and POP are related to ?
  1. Arrays
  2. Stacks
  3. Linked List
  4. None
Show/Hide Answer
Answer = B 
Explanation:PUSH is used for inserting an element into the stack and POP is used for deleting an elements from the stack.

10) The operation of processing element is called ?
  1. Traversing
  2. Inserting
  3. Deleting
  4. Searching
Show/Hide Answer
Answer = A
Explanation:Traversing means visiting or processing each element exactly once.

read more...