Data Structure by Blogspot
Data Structure by Blogspot
com
Multiple Choice Questions
5. The Worst case occur in linear search algorithm
(MCQs) - Objective when
a. Item is somewhere in the middle of the array
b. Item is not in the array at all
c. Item is the last element in the array
d. Item is the last element in the array or is not there at
all
Collection on http://www.cs-mcqs.blogspot.com
Collection on http://www.cs-mcqs.blogspot.com
1. Two main measures for the efficiency of an algorithm
are 7. The complexity of the average case of an algorithm
a. Processor and memory is
b. Complexity and capacity a. Much more complicated to analyze than that of worst
c. Time and space case
d. Data and space b. Much more simpler to analyze than that of worst case
c. Sometimes more complicated and some other times
Collection on http://www.cs-mcqs.blogspot.com simpler than that of worst case
d. None or above
Collection on http://www.cs-mcqs.blogspot.com
2. The time factor when determining the efficiency of
algorithm is measured by
a. Counting microseconds 8. The complexity of linear search algorithm is
b. Counting the number of key operations a. O(n)
c. Counting the number of statements b. O(log n)
d. Counting the kilobytes of algorithm c. O(n2)
d. O(n log n)
Collection on http://www.cs-mcqs.blogspot.com
Collection on http://www.cs-mcqs.blogspot.com
3. The space factor when determining the efficiency of
algorithm is measured by 9. The complexity of Binary search algorithm is
a. Counting the maximum memory needed by the a. O(n)
algorithm b. O(log )
b. Counting the minimum memory needed by the c. O(n2)
algorithm d. O(n log n)
c. Counting the average memory needed by the
algorithm Collection on http://www.cs-mcqs.blogspot.com
d. Counting the maximum disk space needed by the
algorithm 10. The complexity of Bubble sort algorithm is
a. O(n)
Collection on http://www.cs-mcqs.blogspot.com b. O(log n)
c. O(n2)
4. Which of the following case does not exist in d. O(n log n)
complexity theory
a. Best case Collection on http://www.cs-mcqs.blogspot.com
b. Worst case
c. Average case 11. The complexity of merge sort algorithm is
d. Null case a. O(n)
b. O(log n)
c. O(n2) a. for relatively permanent collections of data
d. O(n log n) b. for the size of the structure and the data in the
structure are constantly changing
Collection on http://www.cs-mcqs.blogspot.com c. for both of above situation
d. for none of above situation
12. The indirect change of the values of a variable in
one module by another module is called Collection on http://www.cs-mcqs.blogspot.com
a. internal change
b. inter-module change 19. Each array declaration need not give, implicitly or
c. side effect explicitly, the information about
d. side-module update a. the name of array
b. the data type of array
Collection on http://www.cs-mcqs.blogspot.com c. the first data from the set to be stored
d. the index set of the array
13. Which of the following data structure is not linear
data structure? Collection on http://www.cs-mcqs.blogspot.com
a. Arrays
b. Linked lists 20. The elements of an array are stored successively in
c. Both of above memory cells because
d. None of above a. by this way computer can keep track only the
address of the first element and the addresses of other
Collection on http://www.cs-mcqs.blogspot.com elements can be calculated
b. the architecture of computer memory does not allow
14. Which of the following data structure is linear data arrays to store other than serially
structure? c. both of above
a. Trees d. none of above
b. Graphs
c. Arrays Collection on http://www.cs-mcqs.blogspot.com
d. None of above
Collection on http://www.cs-mcqs.blogspot.com
13. Binary search algorithm can not be applied to 1. The memory address of the first element of an array
a. sorted linked list is called
b. sorted binary trees d. base address
c. sorted linear array
d. pointer array 2. The memory address of fifth element of an array can
be calculated by the formula
14. When new data are to be inserted into a data a. LOC(Array[5]=Base(Array)+w(5-lower bound), where
structure, but there is no available space; this situation w is the number of words per memory cell for the array
is usually called
a. underflow 3. Which of the following data structures are indexed
b. overflow structures?
c. housefull a. linear arrays
d. saturated
4. Which of the following is not the required condition for
15. The situation when in a linked list START=NULL is binary search algorithm?
a. underflow c. There must be mechanism to delete and/or insert
b. overflow elements in list
c. housefull
d. saturated 5. Which of the following is not a limitation of binary
search algorithm?
16. Which of the following is two way list? d. binary search algorithm is not efficient when the data
a. grounded header list elements are more than 1000.
b. circular header list
c. linked list with header and trailer nodes 6. Two dimensional arrays are also called
d. none of above c. both of above
17. Which of the following name does not relate to 7. A variable P is called pointer if
stacks? a. P contains the address of an element in DATA.
a. FIFO lists
b. LIFO list 8. Which of the following data structure can't store the
c. Piles non-homogeneous data elements?
d. Push-down lists a. Arrays
18. The term "push" and "pop" is related to the 9. Which of the following data structure store the non-
a. array homogeneous data elements?
b. lists b. Records
c. stacks
d. all of above 10. Each data item in a record may be a group item
composed of sub-items; those items which are
19. A data structure where elements can be added or indecomposable are called
removed at either end but not in the middle d. all of above
a. Linked lists
b. Stacks 11. The difference between linear array and a record is
c. Queues d. All of above
d. Deque
12. Which of the following statement is false?
c. pointers store the next data element of a list
c. Queues
13. Binary search algorithm can not be applied to d. All of above
a. sorted linked list
5. To represent hierarchical relationship between
14. When new data are to be inserted into a data elements, which data structure is suitable?
structure, but there is no available space; this situation a. Deque
is usually called b. Priority
b. overflow c. Tree
d. All of above
15. The situation when in a linked list START=NULL is
a. underflow 6. A binary tree whose every node has either zero or
two children is called
16. Which of the following is two way list? a. Complete binary tree
d. none of above b. Binary search tree
c. Extended binary tree
d. None of above
17. Which of the following name does not relate to
stacks?
a. FIFO lists 7. The depth of a complete binary tree is given by
a. Dn = n log2n
b. Dn = n log2n+1
18. The term "push" and "pop" is related to the
c. Dn = log2n
c. stacks
d. Dn = log2n+1
19. A data structure where elements can be added or
8. When representing any algebraic expression E
removed at either end but not in the middle
which uses only binary operations in a 2-tree,
d. Deque
a. the variable in E will appear as external nodes and
operations in internal nodes
20. When inorder traversing a tree resulted E A C K F H b. the operations in E will appear as external nodes and
D B G; the preorder traversal would return variables in internal nodes
b. FAEKCDHGB c. the variables and operations in E will appear only in
internal nodes
14. In a binary tree, certain null entries are replaced by 2. Identify the data structure which allows deletions at
special pointers which point to nodes higher in the tree both ends of the list but insertion at only one end.
for efficiency. These special pointers are called a. Input-restricted deque
a. Leaf
b. branch 3. Which of the following data structure is non-linear
c. path type?
d. thread d. None of above
15. The in order traversal of tree will yield a sorted 4. Which of the following data structure is linear type?
listing of elements of tree in d. All of above
a. Binary trees
b. Binary search trees 5. To represent hierarchical relationship between
c. Heaps elements, which data structure is suitable?
d. None of above c. Tree
16. In a Heap tree 6. A binary tree whose every node has either zero or
a. Values in a node is greater than every value in left two children is called
sub tree and smaller than right sub tree c. Extended binary tree
b. Values in a node is greater than every value in
children of it 7. The depth of a complete binary tree is given by
c. Both of above conditions applies d. Dn = log2n + 1
d. None of above conditions applies
8. When representing any algebraic expression E
17. In a graph if e=[u, v], Then u and v are called which uses only binary operations in a 2-tree,
a. endpoints of e a. the variable in E will appear as external nodes and
b. adjacent nodes operations in internal nodes
c. neighbors
d. all of above 9. A binary tree can easily be converted into q 2-tree
d. by replacing each empty sub tree by a new external
18. A connected graph T without any cycles is called node
a. a tree graph
b. free tree 10. When converting binary tree into extended binary
c. a tree tree, all the original nodes in binary tree are
d. All of above a. internal nodes on extended tree
19. In a graph if e=(u, v) means 11. The post order traversal of a binary tree is DEBFCA.
a. u is adjacent to v but v is not adjacent to u Find out the pre order traversal
b. e begins at u and ends at v c. ABDECF
c. u is processor and v is successor
d. both b and c 12. Which of the following sorting algorithm is of divide-
and-conquer type?
20. If every node u in G is adjacent to every other node c. Quick sort
v in G, A graph is said to be
a. isolated 13. An algorithm that calls itself directly or indirectly is
b. complete known as
c. finite b. Recursion
d. strongly connected
14. 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
d. thread
c. for both of above situation
15. The in order traversal of tree will yield a sorted d. for none of above situation
listing of elements of tree in
b. Binary search trees
4. If the values of a variable in one module is
16. In a Heap tree
b. Values in a node is greater than every value in indirectly changed by another module, this
children of it situation is called
17. In a graph if e=[u, v], Then u and v are called a. internal change
d. all of above
b. inter-module change
18. A connected graph T without any cycles is called c. side effect
d. All of above
d. side-module update
19. In a graph if e=(u, v) means
d. both b and c
5. In linear search algorithm the Worst case
20. If every node u in G is adjacent to every other node occurs when
v in G, A graph is said to be
b. complete a. The item is somewhere in the middle of the
Data Structures And Algorithms MCQ array
Questions
b. The item is not in the array at all
c. The item is the last element in the array
1. When determining the efficiency of
d. The item is the last element in the array or is
algorithm, the space factor is measured by
not there at all
a. Counting the maximum memory needed by the
algorithm 6. For an algorithm the complexity of the
b. Counting the minimum memory needed by the average case is
algorithm a. Much more complicated to analyze than that of
c. Counting the average memory needed by the worst case
algorithm b. Much more simpler to analyze than that of
d. Counting the maximum disk space needed by worst case
the algorithm c. Sometimes more complicated and some other
times simpler than that of worst case
2. The complexity of Bubble sort algorithm is
d. None or above
a. O(n)
b. O(log n) 7. The complexity of merge sort algorithm is
c. O(n2) a. O(n)
d. O(n log n) b. O(log n)
c. O(n2)
3. Linked lists are best suited
d. O(n log n)
a. for relatively permanent collections of data
b. for the size of the structure and the data in the 8. The complexity of linear search algorithm is
structure are constantly changing a. O(n)
b. O(log n) array
c. O(n2) b. When Item is not in the array at all
d. O(n log n) c. When Item is the last element in the array
d. When Item is the last element in the array or is
9. When determining the efficiency of algorithm not there at all
the time factor is measured by
a. Counting microseconds 14. Two main measures for the efficiency of an
b. Counting the number of key operations algorithm are
c. Counting the number of statements a. Processor and memory
d. Counting the kilobytes of algorithm b. Complexity and capacity
c. Time and space
10. Which of the following data structure is d. Data and space
linear data structure?
a. Trees 15. Finding the location of the element with a
b. Graphs given value is:
c. Arrays a. Traversal
d. None of above b. Search
c. Sort
11. The elements of an array are stored d. None of above
successively in memory cells because
a. by this way computer can keep track only the 16. Which of the following case does not exist in
address of the first element and the addresses of complexity theory
other elements can be calculated a. Best case
b. the architecture of computer memory does not b. Worst case
allow arrays to store other than serially c. Average case
c. both of above d. Null case
d. none of above
17. The operation of processing each element
12. Which of the following data structure is not in the list is known as
linear data structure? a. Sorting
a. Arrays b. Merging
b. Linked lists c. Inserting
c. Both of above d. Traversal
d. None of above
18. Arrays are best data structures
13. The Average case occur in linear search a. for relatively permanent collections of data
algorithm b. for the size of the structure and the data in the
a. When Item is somewhere in the middle of the structure are constantly changing
c. for both of above situation
d. for none of above situation A. Insertion Sort
B. Bubble Sort
19. Each array declaration need not give, C. Merge Sort
implicitly or explicitly, the information about D. Tree Sort
a. the name of array
b. the data type of array
3) Very slow way of sorting is ..........
c. the first data from the set to be stored
d. the index set of the array
A. Insertion sort
11 – A 12 – D 13 – A 14 – C 15 – B
A. O(n)
2) Before inserting into stack one must
B. O(n2)
check the condition .........
C. O(n logn)
A. Overflow
D. O(logn)
B. Underflow
Answers: C. Maximum elements
D. Existing elements
1) C. Searching 3) The another name of dequeue is .........
2) C. Merge Sort A. divided queue
3) A. Insertion sort B. distributed queue
4) D. Tree Sort C. double ended queue
5) B. Primary key D. design queue
6) D. O(n logn)
7) D. Smallest element 4) Before deletion condition into stack ......
8) D. partition and exchange sort has to be checked.
9) C. Merging A. Overflow
10) C. heap
11) C. Radix B. Underflow
12) D. selection sort C. Maximum elements
13) C. Quick sort D. Existing elements
14) A. k way merging
15) B. Hash function 5) In dequeue, insertion and deletion takes
16) C. Radix place of ..........
17) A. O(n logn) A. front, rear end
B. only at rear end
C. only at front end 10) The condition ........ indicate the queue
D. both the ends is empty.
7) A queue in which insertion and deletion 11) Which of the following is not the type of
takes places from any positionis called ...... queue?
Answers:
A. Priority queue
B. Procedure queue
1) C. circular
C. Main queue
2) A. Overflow
D. Interrupt queue
3) C. double ended queue
4) B. Underflow
17) The deletion operation in stack is
5) D. both the ends
called ......
6) A. Before insertion
A. insert
7) C. priority
B. push
8) A. Node pointed by the start process
C. pop
9) A. FIFO lists
D. top
10) A. Front=Null
11) B. Special queue
18) Link fields holds pointers to the ..........
12) C. An element is added in a queue
element in the linked representation of
13) D. All of the above
stack.
14) A. Double ended queue
15) D. All of the above
A. Neighbouring
16) A. Priority queue
B. Last
17) C. pop
C. First
18) A. Neighbouring
D. Middle
19) C. top
20) A. Decrease the numbers of times
19) The pointer associated with the stack
overflow may occur
is ...........
Solved MCQ On Tree And Graph In is called ........
Data Structure Set-1 A. free graph
B. no cycle graph
1) The operation of processing each element C. non cycle graph
in the list is known as ...... D. circular graph
A. sorting
B. merging 7) Trees are said .......... if they are similar
C. inserting and have same contents at corresponding
D. traversal nodes.
A. Duplicate
2) Other name for directed graph is .......... B. Carbon copy
A. Direct graph C. Replica
B. Digraph D. Copies
C. Dir-graph
D. Digraph 8) A connected graph T without any cycles
is called a ........
3) Binary trees with threads are called
as ....... A. A tree graph
A. Threaded trees B. Free tree
B. Pointer trees C. A tree d
C. Special trees D. All of the above
D. Special pointer trees
4) Graph G is .............. if for any pair u, v 9) Every node N in a binary tree T except
of nodes in G there is a path from u to v or the root has a unique parent called
path from v to u. the ......... of N.
A. Leterally connected A. Antecedents
B. Widely Connected B. Predecessor
C. Unliterally connected C. Forerunner
D. Literally connected D. Precursor
5) In Binary trees nodes with no successor 10) In a graph if E=(u,v) means ......
are called ......
A. u is adjacent to v but v is not adjacent to
A. End nodes u
B. Terminal nodes B. e begins at u and ends at v
C. Final nodes C. u is processor and v is successor
D. Last nodes D. both b and c
6) A connected graph T without any cycles 11) Sequential representation of binary tree
uses ........ A. Exterior node
B. Outside node
A. Array with pointers C. Outer node
B. Single linear array D. External node
C. Two dimentional arrays
D. Three dimentional arrays 18) Which indicates pre-order traversal?
A. Left sub-tree, Right sub-tree and root
12) In a graph if e=[u,v], Then u and v are B. Right sub-tree, Left sub-tree and root
called ........ C. Root, Left sub-tree, Right sub-tree
D. Right sub-tree, root, Left sub-tree
A. End points of e
B. Adjacent nodes 19) In a extended-binary tree nodes with 2
C. Neighbours children are called ........
D. All of the above A. Interior node
13) TREE[1]=NULL indicates tree is ........ B. Domestic node
A. Overflow C. Internal node
B. Underflow D. Inner node
C. Empty 20) A terminal node in a binary tree is called
D. Full ............
14) A binary tree whose every node has A. Root
either zero or two children is called ....... B. Leaf
A. complete binary tree C. Child
B. binary search tree D. Branch
C. extended binary tree
Answers:
D. data structure
1) D. traversal
15) Linked representation of binary tree
2) D. Digraph
needs ......... parallel arrays.
A. 4 3) A. Threaded trees
B. 2 4) C. Unliterally connected
C. 3 5) B. Terminal nodes
D. 5 6) A. free graph
16) The depth of complete binary tree is 7) D. Copies
given by ...... 8) D. All of the above
A. Dn = n log2n 9) B. Predecessor
B. Dn= n log2n+1 10) D. both b and c
C. Dn = log2n 11) A. Array with pointers
D. Dn = log2n+1 12) D. All of the above
17) In a 2-tree, nodes with 0 children are 13) C. Empty
called ............ 14) C. extended binary tree
15) C. 3 nodes higher in the tree for efficiency. These
16) D. Dn = log2n+1 special pointers are called .........
17) D. External node
A. Leaf
18) C. Root, Left sub-tree, Right sub-tree
B. Branch
19) C. Internal node
C. Path
20) B. Leaf
D. Thread
Objective Questions On Tree And
Graph In Data Structure Set-2 5) In a head tree .....
1) The post order traversal of binary tree is
A. values in a node is greater than every
DEBFCA. Find out the pre order traversal.
value every value in left sub tree and
A. ABFCDE smaller than right sub tree.
3) The in-order traversal of tree will yield a 7) In a graph if e=(u,v) means .......
sorted listing of elements oftree in ........
A. u is adjacent to v but v is not adjacent to
A. binary trees u.
4) In a binary tree, certain null entries are 8) A binary tree whose every node has
replaced by special pointers which point to either zero or two children is called .........
A. Complete binary tree C. EAFKHDCBG
A. isolated C. a tree
10. A) Stack
4) Each node in singly linked list has ........
11. B) Queues
fields.
12. A) Arrays
13. A) Queue linked list A. 2
14. D) Trees
B. 3
15. C) Binary tree
16. B) queue C. 1
17. A) Input restricted dequeue
D. 4
18. D) Graph
19. D) Stack 5) Which of the following is two way lists?
20. C) Tree
A. Grounded header list
1) Linked lists are best suited .....
B. Circular header list
A. FIRST
C. data structure
B. AVAIL
D. for none of above situation
C. TOP
2) The operation of processing each element
in the list is known as ...... D. REAR
B. merging A. 0
C. inserting
B. 1 12) LLINK is the pointer pointing to the ...
C. -1 A. successor node
D. 2 B. predecessor node
B. last record of the actual data 15) A ...... indicates the end of the list.
D) (N+2)/2
2. In the …………….. traversal we process all 6. In ……………, search start at the beginning
of a vertex’s descendents before we move of the list and check everyelement in the
to an adjacent vertex. list.
A) Depth First A) Linear search
B) Breadth First
C) With First B) Binary search
D) Depth Limited
C) Hash Search
3. State True of False.
D) Binary Tree searc
i) Network is a graph that has weights or
costs associated with it. 7. State True or False.
ii) An undirected graph which contains no
cycles is called a forest. i) Binary search is used for searching in a
iii) A graph is said to be complete if there is sorted array.
no edge between every pair of vertices.
A) True, False, True ii) The time complexity of binary search is
B) True, True, False O(logn).
C) True, True, True
D) False, True, True A) True, False
4. Match the following.
a) Completeness i) How long does it B) False, True
take to find a solution
b) Time Complexity ii) How much memory C) False, False
need to perform the search.
c) Space Complexity iii) Is the strategy D) True, True
guaranteed to find the solution when there
in one. 8. Which of the following is not the internal
sort?
A) a-iii, b-ii, c-i A) Insertion Sort
C) -1 and 0 A) 5
D) 1 and 0 B) 6
12. In a circular queue the value of r will
be . C) 4
A) r=r+1
D) None
B) r=(r+1)% [QUEUE_SIZE – 1]
16. ………… is not the operation that can be
C) r=(r+1)% QUEUE_SIZE performed on queue.
A) Insertion
D) r=(r-1)% QUEUE_SIZE B) Deletion
C) Retrieval
13. Which of the following statement is D) Traversal
true? 17. There is an extra element at the head
i) Using singly linked lists and circular list, it of the list called a ……….
is not possible to traverse the A) Antinel
B) Sentinel 2) A singly linked list is also called as ........
C) List header
D) List head A. linked list
18. A graph is a collection of nodes, called
………. And line segments called arcs or B. one way chain
……….. that connect pair of nodes.
C. two way chain
A) vertices, edges
D. right link
B) edges, vertices
3) A ..... list is a header list where the node
points back to the header node.
C) vertices, paths
A. Circular header
D) graph node, edges
B. Grounded header
19. A ……….. is a graph that has weights of
costs associated with its edges. C. Two way header
C) [log2n] A. Polynomials
D) [log2n]+1 B. Binomial
C. free pool
8) A doubly linked list is also called C. Linked list with header and trailer nodes
as ..........
D. None of the above
A. linked list
13) A .......... is a header list where the last
B. one way chain node contains the null pointer.
19) Which of the following conditions checks 13) A. grounded header list
available free space in avail list?
14) A. successor node
A. Avail=Null
15) B. circular header list
B. Null=Avail
16) D. all of the above
C. Avail=Max stack
17) C. 3
D. Avail=Top
18) A. it is possible to get into infinite loop
19) A. Avail=Null C) Vertical array
D) Tree
A) Array
A) Data structure
B) Linear array
B) One-dimensional array
A) Linear array