Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
24 views16 pages

Data Structure - MCQ Questions

The document contains multiple-choice questions related to Data Structures and Algorithms, covering various topics such as binary trees, sorting algorithms, data representation, and graph theory. Each question is followed by the correct answer, providing a comprehensive review tool for students. It serves as a study guide for B.Tech students at Pondicherry University.

Uploaded by

gg3385
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views16 pages

Data Structure - MCQ Questions

The document contains multiple-choice questions related to Data Structures and Algorithms, covering various topics such as binary trees, sorting algorithms, data representation, and graph theory. Each question is followed by the correct answer, providing a comprehensive review tool for students. It serves as a study guide for B.Tech students at Pondicherry University.

Uploaded by

gg3385
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Data structure - mcq questions

Data Structures (Pondicherry University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by M. Uma Devi
OBJECTIVE TYPE QUESTIONS

Subject : Data Structures and Algorithm Group:B.Tech

Q1. A binary tree of depth “d” is an almost complete binary tree if

(A) Each leaf in the tree is either at level “d” or at level “d–1”

(B) For any node “n” in the tree with a right descendent at level “d” all the left
descendents of “n” that are leaves, are also at level “d”

(C) Both (A) &

(B) (D) None of

the above

ANSWER: 1:C

Q2. A linear collection of data elements where the linear node is given by means of

pointer is called

(A) linked list (B) node list

(C) primitive list (D) None of these

ANSWER: 2:A

Q3. Representation of data structure in memory is known as:

(A) recursive (B) abstract data type

(C) storage structure (D) file structure

ANSWER: 3:B

Q4. If the address of A[1][1] and A[2][1] are 1000 and 1010 respectively and each

element occupies 2 bytes then the array has been stored in order.

(A) row major (B) column major

(C) matix major (D) none of these


Downloaded by M. Uma Devi
ANSWER: 4:A

Q5. An adjacency matrix representation of a graph cannot contain

information of : (A) nodes (B) edges

(C) direction of edges (D) parallel edges

ANSWER: 5:D

Q6. Quick sort is also known as

(A) merge sort (B) heap sort

(C) bubble sort (D) none of these

ANSWER: 6:D

Q7. An ADT is defined to be a mathematical model of a user-defined type along


with the collection of all operations on that model.

(A) Cardinality (B) Assignment

(C) Primitive (D) Structured


ANSWER: 7:C

Q8. An algorithm is made up of two independent time complexities f (n) and g (n).

Then the complexities of the algorithm is in the order of

(A) f(n) x g(n) (B) Max ( f(n),g(n))

(C) Min (f(n),g(n)) (D) f(n) + g(n)

ANSWER: 8:B

Q9. The goal of hashing is to produce a search that takes

(A) O(1) time (B) O(n2 ) time

(C) O(log n ) time (D) O(n log n ) time

ANSWER: 9:A

Downloaded by M. Uma Devi


Q10. The best average behaviour is shown by

(A) Quick Sort (B) Merge Sort

(C) Insertion Sort (D) Heap Sort

ANSWER: 10:A

Q11. What is the postfix form of the following prefix *+ab–cd

(A) ab+cd–* (B) abc+*–

(C) ab+*cd– (D) ab+*cd–

ANSWER: 11:A

Q.12 A queue is a,

(A) FIFO (First In First Out) list. (B) LIFO (Last In First Out) list.

(C) Ordered array. (D) Linear tree.

ANSWER: 12. (A)

Q13. Which data structure is needed to convert infix notation to postfix notation?
(A) Branch (B) Queue

(C) Tree (D) Stack

ANSWER: 13. (D)

Q14. Which of the following operations is performed more efficiently by doubly linked

list than by singly linked list?

(A) Deleting a node whose location in given

(B) Searching of an unsorted list for a given item

(C) Inverting a node after the node with given location

(D) Traversing a list to process each node

ANSWER: 14. (A)

Downloaded by M. Uma Devi


Q15. The extra key inserted at the end of the array is called a,

(A) End key. (B) Stop key.

(C) Sentinel. (D) Transposition.

ANSWER: 15. (C)

Q16. Consider that n elements are to be sorted. What is the worst case time
complexity of
Bubble sort?

(A) O(1) (B) O(log2n)

(C) O(n) (D) O(n2)

ANSWER: 16. (D)

Q17. A characteristic of the data that binary search uses but the linear search

ignores is the .

(A) Order of the elements of the

list. (B) Length of the list.

(C) Maximum value in list.

(D) Type of elements of the list.

ANSWER: 17. (A)

Q18. In Breadth First Search of Graph, which of the following data structure

is used?

(A) Stack. (B) Queue.

(C) Linked List. (D) None of the above.

ANSWER: 18. (B)

Q19. The largest element of an array index is called its

(A) lower bound. (B) range.


(C) upper bound. (D) All of these.

Downloaded by M. Uma Devi


ANSWER: 19. (C)

Q20.What is the result of the following operation


Top (Push (S, X))

(A) X (B) null


(C) S (D) None of these.
ANSWER: 20. (A)

Which of the following algorithm solves the all pair shortest path problem ?
a. Dijkstra's algorithm
b. Floyd's algorithm
c. Prim's algorithm
d. Warshall's algorithm
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. –
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 ?
a. Bubble sort
b. Insertion sort
c. Selection sort
d. Heap sort
Answer = B

8) 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. selection sort
c. insertion sort
d. merge sort
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

The average successful search time for sequential search on 'n' items is ?
a. n/2
b. (n - 1)/2
Downloaded by M. Uma Devi
c. (n + 2)/2
d. log(n) + 1
Show/Hide Answer
Answer = C

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 ?
a. 2, 2, 1, 1, 2
b. 2, 2, 1, 2, 2
c. 2, 1, 2, 2, 1
d. 2, 1, 2, 2, 2
Show/Hide Answer
Answer = A
Explanation: The elements are popped from the top of the stack.
- See more at: http://edugrip.blogspot.in/2012/08/data-structure-
multiple- choice.html#sthash.r4P5Qd6T.dpuf

Sparse matrices have ?


a. many zero entries
b. many non- zero entries
c. higher dimension
d. none of above
Show/Hide Answer
Answer = A Explanation: A sparse matrix is a matrix populated primarily with zeros
- See more at: http://edugrip.blogspot.in/2012/08/data-structure-
multiple- choice.html#sthash.KRCZRhXN.dpuf

What is Data Structure ?


a. Way to organize data
b. Accessing of data elements in specified manner
c. Organization of mathematical and logical concepts
d. 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 ?


a. Traversing

Downloaded by M. Uma Devi


b. Insertion
c. Reading
d. 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 ?


a. Floor Address
b. Foundation Address
c. First Address
d. 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 ?


a. 0
b. -1
c. 1
d. None of Above
Show/Hide Answer
Answer = 0
Explanation: No explanation for this question.

5) Two dimensional arrays are also called ?


a. Matrix Array
b. Table Array
c. Both a and b
d. 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 ?


a. Overflow
b. Underflow
Downloaded by M. Uma Devi
c. Both of above
d. 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 ?


a. UB - LB + 1
b. LB + UB
c. LB - UB
d. 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 ?
a. List should be small in number
b. List should be large in number
c. List should be sorted
d. 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 ?


a. Arrays
b. Stacks
c. Linked List
d. 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 ?


a. Traversing
b. Inserting

Downloaded by M. Uma Devi


c. Deleting

Downloaded by M. Uma Devi


d. Searching
Show/Hide Answer
Answer = A
Explanation:Traversing means visiting or processing each element exactly once.

1. Which of the following is not the type of queue?


A) Ordinary queue
B) Single ended queue
C) Circular queue
D) Priority queue

Answer: B) Single ended queue

2. The property of binary tree is


A) The first subset is called left subtree
B) The second subtree is called right subtree
C) The root cannot contain NULL
D) The right subtree can be empty

Answer: 2. D) The right.............empty


3. State true or false.
i) The degree of root node is always zero.
ii) Nodes that are not root and not leaf are called as internal nodes.
A) True, True
B) True, False
C) False, True
D) False, False
Answer: 3. C) False, True
4. Any node is the path from the root to the node is called
A) Successor node
B) Ancestor node
C) Internal node
D) None of the above
Answer: 4. B) Ancestor node
5. State true of false.
i) A node is a parent if it has successor nodes.
ii) A node is child node if out degree is one.
A) True, True
B) True, False
C) False, True
D) False, False
Answer: 5. B) True, False

6 is not an operation performed on linear list


a) Insertion b) Deletion c) Retrieval d) Traversal
A) only a,b and c
B) only a and b
C) All of the above
Downloaded by M. Uma Devi
D) None of the above
Answer: 6. D) None of the above

7. Which is/are the application(s) of stack


A) Function calls
B) Large number Arithmetic
C) Evaluation of arithmetic expressions
D) All of the above
Answer: 7. D) All of the above

8. A.....................is an acyclic digraph, which has only one node with indegree 0, and other nodes
have indegree 1.
A) Directed tree
B) Undirected tree
C) Dis-joint tree
D) Direction oriented tree
Answer: 8. A) Directed tree
9 Is a directed tree in which outdegree of each node is less than or equal to two.
A) Unary tree
B) Binary tree
C) Dinary tree
D) Both B and C
Answer: 9. B) Binary tree
10. State true or false.
i) An empty tree is also a binary tree.
ii) In strictly binary tree, the outdegree of every node is either o or 2.
A) True, False
B) False, True
C) True, True
D) False, False
Answer: C) True, True

1. A directed graph is...........................if there is a path from each vertex to every other vertex in the
digraph.
A) Weakly connected
B) Strongly Connected
C) Tightly Connected
D) Linearly Connected
Answer: 1. B) Strongly Connected

2. In the........................traversal we process all of a vertex’s descendents before we move to an


adjacent vertex.
A) Depth First
B) Breadth First
C) With First
D) Depth Limited
Answer: 2. A) Depth First

Downloaded by M. Uma Devi


3. State True of False.
i) Network is a graph that has weights or costs associated with it.
ii) An undirected graph which contains no cycles is called a forest.
iii) A graph is said to be complete if there is no edge between every pair of vertices.
A) True, False, True
B) True, True, False
C) True, True, True
D) False, True, True

Answer: 3. B) True, True, False


4. Match the following.
a) Completeness i) How long does it take to find a solution
b) Time Complexity ii) How much memory need to perform the search.
c) Space Complexity iii) Is the strategy guaranteed to find the solution when there
in one.

A) a-iii, b-ii, c-i


B) a-i, b-ii, c-iii
C) a-iii, b-i, c-ii
D) a-i, b-iii, c-ii

Answer: 4. C) a-iii, b-i, c-ii


5. The number of comparisons done by sequential search is ………………
A) (N/2)+1
B) (N+1)/2
C) (N-1)/2
D) (N+2)/2
Answer: 5. B) (N+1)/2

6. In....................., search start at the beginning of the list and check every element in the list.
A) Linear search
B) Binary search
C) Hash Search
D) Binary Tree search
Answer: 6. A) Linear search

7. State True or False.


i) Binary search is used for searching in a sorted array.
ii) The time complexity of binary search is O(logn).
A) True, False
B) False, True
C) False, False
D) True, True
Answer: 7. D) True, True

8. Which of the following is not the internal sort?


A) Insertion Sort
B) Bubble Sort
Downloaded by M. Uma Devi
C) Merge Sort
D) Heap Sort

Answer: 8. C) Merge Sort

9. State True or False.


i) An undirected graph which contains no cycles is called forest.
ii) A graph is said to be complete if there is an edge between every pair of vertices.
A) True, True
B) False, True
C) False, False
D) True, False
Answer: 9. A) True, True

10. A graph is said to be..........................if the vertices can be split into two sets V1 and V2 such
there are no edges between two vertices of V1 or two vertices of V2.
A) Partite
B) Bipartite
C) Rooted
D) Bisects

Answer: 10. B) Bipartite

11. In a queue, the initial values of front pointer f rare pointer r should be …….. and
……….. respectively.
A) 0 and 1
B) 0 and -1
C) -1 and 0
D) 1 and 0

Answer: 11. B) 0 and -1

12. In a circular queue the value of r will be ..


A) r=r+1
B) r=(r+1)% [QUEUE_SIZE – 1]
C) r=(r+1)% QUEUE_SIZE
D) r=(r-1)% QUEUE_SIZE

Answer: 12. C) r=(r+1)% QUEUE_SIZE

13. Which of the following statement is true?


i) Using singly linked lists and circular list, it is not possible to traverse the list backwards.
ii) To find the predecessor, it is required to traverse the list from the first node in case of
singly linked list.
A) i-only
B) ii-only
C) Both i and ii
D) None of both
Downloaded by M. Uma Devi
Answer: 13. C) Both i and ii

14. The advantage of........................is that they solve the problem if sequential storage
representation. But disadvantage in that is they are sequential lists.
A) Lists
B) Linked Lists
C) Trees
D) Queues

Answer: 14. B) Linked Lists

15. What will be the value of top, if there is a size of stack STACK_SIZE is 5
A) 5
B) 6
C) 4
D) None

Answer: 15. C) 4

16...................is not the operation that can be performed on queue.


A) Insertion
B) Deletion
C) Retrieval
D) Traversal

Answer: 16. D) Traversal

17. There is an extra element at the head of the list called a ……….
A) Antinel
B) Sentinel
C) List header
D) List head

Answer: 17. B) Sentinel

18. A graph is a collection of nodes, called ………. And line segments called arcs or................that
connect pair of nodes.
A) vertices, edges
B) edges, vertices
C) vertices, paths
D) graph node, edges

Answer: 18. A) vertices, edges

19. A...............is a graph that has weights of costs associated with its edges.
Downloaded by M. Uma Devi
A) Network
B) Weighted graph
C) Both A and B
D) None A and B

Answer: 19. C) Both A and B

20. In general, the binary search method needs no more than.......................comparisons.


A) [log2n]-1
B) [logn]+1
C) [log2n]
D) [log2n]+1

Answer: 20. D) [log2n]+1

Downloaded by M. Uma Devi

You might also like