Data Structure MCQs

advertisement
MCQ’s DATASTRUCTURE
By: Kalim Ullah Khan
eatvc swat #+92-3329209693
Data Structure Multiple Choice Questions And Answers - Set 2
Tags: Data Structure
Data Structure Objective Type Questions And Answers
Tags: Data Structure
Data Structure Multiple choice and objective type questions.
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 ?
is far less than one
equals one
is far greater than one
None of above
Show/Hide Answer
Answer = A
Explanation: No Explanation
2) The complexity of binary search algorithm is ?
n
nlogn
logn
n2
Show/Hide Answer
Answer = D
Explanation:N/A
3) The postfix equivalent of the prefix * + ab - cd is ?
ab + cd - *
abcd + - *
ab + cd * 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?
Conceptually easier
Completely dynamic
Efficient in accessing an entry
Efficient if the sparse matrix is a band matrix
A and B
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 ?
2, 2, 1, 1, 2
2, 2, 1, 2, 2
2, 1, 2, 2, 1
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 ?
radix sort
quick sort
recursion
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?
400 names
800 names
750 names
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.
MCQ’s DATASTRUCTURE
By: Kalim Ullah Khan
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
?
50.2 sec
6.7 sec
72.7 sec
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 ?
3
9
7
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 ?
is far less than one
equals one
is far greater than one
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
eatvc swat #+92-3329209693
Show/Hide Answer
Answer = E
Explanation: N/A
5) Sparse matrix have ?
many zero entries
many non-zero entries
higher dimension
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 ?
Dijkstra's algorithm
Floyd's algorithm
Prim's algorithm
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 ?
Bubble sort
Insertion sort
Selection sort
Heap sort
Show/Hide Answer
Answer = B
Explanation:N/A
MCQ’s DATASTRUCTURE
By: Kalim Ullah Khan
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 ?
log2n
n-1
n
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 ?
Interrupts
DMA
Polling
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 ?
many zero entries
many non- zero entries
higher dimension
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?
ab + cd - *
ab cd + - *
ab + cd * ab + - cd *
Show/Hide Answer
eatvc swat #+92-3329209693
8) The way a card game player arranges his cards as he picks them up
one by one, is an example of ?
bubble sort
selection sort
insertion sort
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 ?
n/2
(n - 1)/2
(n + 2)/2
log(n) + 1
Show/Hide Answer
Answer = C
Explanation:N/A
10) Linked lists are suitable for which of the following problems ?
Insertion sort
Binary search
Radix sort
Polynomial manipulation
Show/Hide Answer
Answer = B
Explanation: Through Linked list binary search can be performed
efficiently.
- See more at: http://edugrip.blogspot.com/2012/08/data-structureobjective-type-questions.html#sthash.zJy1Jo5v.dpuf
MCQ’s DATASTRUCTURE
By: Kalim Ullah Khan
Answer = A
Multiple Choice Questions On Data Structure | UGC NET
Exam 2012 Sample
Tags: Data Structure
1)What is Data Structure ?
Way to organize data
Accessing of data elements in specified manner
Organization of mathematical and logical concepts
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 ?
Traversing
Insertion
Reading
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 ?
Floor Address
Foundation Address
First Address
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 ?
0
-1
eatvc swat #+92-3329209693
C Language MCQ - Online Programming Quiz
Tags: C language
1) A self contained block of statements that perform a coherent
task of some kind is called a?
Monitor
Function
Program
Structure
Show/Hide Answer
Answer = B
2) Recursion is sometimes called ?
Circular definition
Complex definition
Procedure
Union
Show/Hide Answer
Answer =A
3) The directive that can be used to test whether an expression
evaluates to a nonzero value or not is ?
#if
#elif
#endif
#exit
Show/Hide Answer
Answer = A
4) The number of arguments supplied from the command line, by
conversion is known as ?
arg c
arg v
#define
#include
Show/Hide Answer
Answer = A
5) The expression X=4+2%-8 evaluates ?
MCQ’s DATASTRUCTURE
By: Kalim Ullah Khan
1
None of Above
Show/Hide Answer
Answer = 0
Explanation: No explanation for this question.
5) Two dimensional arrays are also called ?
Matrix Array
Table Array
Both a and b
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 ?
Overflow
Underflow
Both of above
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 ?
UB - LB + 1
LB + UB
LB - UB
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 ?
List should be small in number
List should be large in number
eatvc swat #+92-3329209693
-6
6
4
None
Show/Hide Answer
Answer =B
6) Determine which of the following is valid character constant ?
'//'
'\0'
'xyz'
'\052'
Show/Hide Answer
Answer = A
7) Given the statement , maruti.engine.bolts=25 . Which of the
following is true?
Structure bolts is nested within structure engine
Structure engine is nested within structure maruti
Structure maruti is nested within structure engine
Structure maruti nested within structure bolts
Show/Hide Answer
Answer =B
8) To access a structure element using a pointer, ......... operator is
used?
dot ( . )
pointer ( & )
pointer ( * )
arrow ( -> )
Show/Hide Answer
Answer =D
9) The ........ operator is a technique to forcefully convert one data
type to the other ?
Cast
Conversion
Type
Uniary
Show/Hide Answer
MCQ’s DATASTRUCTURE
By: Kalim Ullah Khan
eatvc swat #+92-3329209693
List should be sorted
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 ?
Arrays
Stacks
Linked List
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 ?
Traversing
Inserting
Deleting
Searching
Show/Hide Answer
Answer = A
Explanation:Traversing means visiting or processing each
element exactly once.
- See more at: http://edugrip.blogspot.com/2012/04/multiplechoice-questions-on-data.html#sthash.KzdR94tQ.dpuf
Answer = A
10) Which of the following numerical value is invalid constant ?
assignment operator
relational operator
logical operator
bitwise shift operator
Show/Hide Answer
Answer = D
1. What is data structure?
7. What are the notations used in Evaluation of Arithmetic Expressions
using prefix and postfix forms?
A data structure is a way of organizing data that considers not only the items
stored, but also their relationship to each other. Advance knowledge about the
relationship between data items allows designing of efficient algorithms for the
manipulation of data.
Polish and Reverse Polish notations.
8. Convert the expression ((A + B) * C - (D - E) ^ (F + G)) to equivalent
Prefix and Postfix notations.
2. List out the areas in which data structures are applied extensively?
1. Compiler Design,
2. Operating System,
1. Prefix Notation: - * +ABC ^ - DE + FG
2. Postfix Notation: AB + C * DE - FG + ^ -
MCQ’s DATASTRUCTURE
3.
4.
5.
6.
7.
8.
By: Kalim Ullah Khan
Database Management System,
Statistical analysis package,
Numerical Analysis,
Graphics,
Artificial Intelligence,
Simulation
3. What are the major data structures used in the following areas : RDBMS,
Network data model and Hierarchical data model.
1. RDBMS = Array (i.e. Array of structures)
2. Network data model = Graph
3. Hierarchical data model = Trees
4. If you are using C language to implement the heterogeneous linked list,
what pointer type will you use?
The heterogeneous linked list contains different data types in its nodes and we
need a link, pointer to connect them. It is not possible to use ordinary pointers for
this. So we go for void pointer. Void pointer is capable of storing pointer to any
type as it is a generic pointer type.
5. Minimum number of queues needed to implement the priority queue?
Two. One queue is used for actual storing of data and another for storing priorities.
6. What is the data structures used to perform recursion?
Stack. Because of its LIFO (Last In First Out) property it remembers its 'caller' so
knows whom to return when the function has to return. Recursion makes use of
system stack for storing the return addresses of the function calls.
Every recursive function has its equivalent iterative (non-recursive) function. Even
when such equivalent iterative procedures are written, explicit stack is to be used.
eatvc swat #+92-3329209693
9. Sorting is not possible by using which of the following methods?
(Insertion, Selection, Exchange, Deletion)
Sorting is not possible in Deletion. Using insertion we can perform insertion
sort, using selection we can perform selection sort, using exchange we can perform
the bubble sort (and other similar sorting methods). But no sorting method can be
done just using deletion.
10. What are the methods available in storing sequential files ?
1.
2.
3.
4.
Straight merging,
Natural merging,
Polyphase sort,
Distribution of Initial runs.
11. List out few of the Application of tree data-structure?
1. The manipulation of Arithmetic expression,
2. Symbol Table construction,
3. Syntax analysis.
12. List out few of the applications that make use of Multilinked
Structures?
1. Sparse matrix,
2. Index generation.
MCQ’s DATASTRUCTURE
By: Kalim Ullah Khan
eatvc swat #+92-3329209693
13. In tree construction which is the suitable efficient data structure?
(Array, Linked list, Stack, Queue)
19. In RDBMS, what is the efficient data structure used in the internal
storage representation?
Linked list is the suitable efficient data structure.
B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes
searching easier. This corresponds to the records that shall be stored in leaf nodes.
14. What is the type of the algorithm used in solving the 8 Queens
problem?
Backtracking.
15. In an AVL tree, at what condition the balancing is to be done?
If the 'pivotal value' (or the 'Height factor') is greater than 1 or less than -1.
16. What is the bucket size, when the overlapping and collision occur at
same time?
One. If there is only one entry possible in the bucket, when the collision occurs,
there is no way to accommodate the colliding value. This results in the overlapping
of values.
17. Classify the Hashing Functions based on the various methods by which
the key value is found.
20. What is a spanning Tree?
A spanning tree is a tree associated with a network. All the nodes of the graph
appear on the tree once. A minimum spanning tree is a spanning tree organized so
that the total edge weight between nodes is minimized.
21. Does the minimum spanning tree of a graph give the shortest distance
between any 2 specified nodes?
No. The Minimal spanning tree assures that the total weight of the tree is kept at
its minimum. But it doesn't mean that the distance between any two nodes
involved in the minimum-spanning tree is minimum.
22. Which is the simplest file structure? (Sequential, Indexed, Random)
Sequential is the simplest file structure.
23. Whether Linked List is linear or Non-linear data structure?
1.
2.
3.
4.
5.
6.
7.
Direct method,
Subtraction method,
Modulo-Division method,
Digit-Extraction method,
Mid-Square method,
Folding method,
Pseudo-random method.
18. What are the types of Collision Resolution Techniques and the methods
used in each of the type?
1. Open addressing (closed hashing), The methods used include: Overflow
block.
According to Access strategies Linked list is a linear one.
According to Storage Linked List is a Non-linear one.
MCQ’s DATASTRUCTURE
By: Kalim Ullah Khan
2. Closed addressing (open hashing), The methods used include: Linked
list, Binary tree.
eatvc swat #+92-3329209693
Download