MCQ - DS - Unit-1 To 6
MCQ - DS - Unit-1 To 6
MCQ - DS - Unit-1 To 6
Question Q1 Q2 Q3
No a-j a-j a-j
Marks 1 Marks Each 2 Marks Each 4 Marks Each
CO
-Mappin CO-1
g
Q1.
a) ____________ refer to a single unit of value
a. Group item
b. Data item
c. Elementary item
d. Basic item
Answer : b
b) A set of data value and associated operation that are specified accurately, independent of any
particular implementation is called
a. Stack
b. Tree
c. Graph
d. Abstract data type
Answer : d
d) The ____________ notation is used when function g(n) defines lower bound for function f(n)
a. Omega
b. Big O
c. Theta
d. Little Oh
Answer : a
i) Each node in a linear list contain item called link which points to the next node in the list
a. True
b. False
Answer : a
j) ___________ is a variable whose length may vary during the execution of program ?
a. Dynamic
b. Static
c. Semistatic
d. Global
Answer : a
Q.2
a) If string1 = John and string2 = Rivers are merged , the process is called
a. Insertion
b. Deletion
c. Concatenation
d. None of the above
Answer : c
b) _____________ is the problem of deciding whether or not a given string pattern P appers in text T
a. Pattern Matching
b. searching
c. Sorting
d. deletion
Answer : a
i) The term Procedure will be used for an independent algorithmic module which sole particular
problem
a. True
b. False
Answer:- a
j) The Structure is of the form :- if Condition , then :
[Module A]
Else
[Module B]
[End of if structures]
a) Multiple Alternative
b) Double Alternative
c) Single Alternative
d) None of the above
Answer:- b
Q.3
a) Write and Explain Linear Search Algorithm with Example.
b) Explain Complexity of Algorithm.
c) Explain Mathematical notation with example .
d) Explain Algorithmic Notation .
e) Explain various types of storing String .
f) Explain Asymptotic notation for complexity.
g) Write and Explain First Pattern Matching Algorithm with Example.
h) Write and Explain Second/Fast Pattern Matching Algorithm with Example.
h) Explain Word Processing function with Example.
i) Explain String Processing Function with Example.
j) Explain Classification of Data Structures.
Sipna College of Engineering and Technology, Amravati
Department of Computer Science and Engineering
Session 2019-20
Unit :- 2 Year/Sem: Second/4th
Subject :- DATA STRUCTURES Subject Code: 4KS01
Question Q1 Q2 Q3
No a-j a-j a-j
Marks 1 Marks Each 2 Marks Each 4 Marks Each
CO
-Mappin CO-2
g
Q.1
a) Which of the following correctly declares an array?
A. int geeks[20];
B. int geeks;
C. geeks{20};
D. array geeks[20];
Answer: A
A. int[] arr;
B. int arr[[]];
C. int[][]arr;
D. int[[]] arr;
Answer: C
A. Binary trees
B. Scheduling of processes
C. Caching
D. Spatial locality
Answer: D
e) What are the advantages of arrays?
A. 15
B. 19
C. 11
D. 60
Answer: D
A. 0
B. -1
C. 2
D. 1
Answer: A
i) Elements in an array are accessed _____________
A.
Randomly
B.
Sequentially
C.
Exponentially
D.
Logarithmically
Answer: A
j) How do you initialize an array in C?
Answer: C
Q.2
a) A program P reads in 500 integers in the range [0..100] exepresenting the scores of 500
students. It then prints the frequency of each score above 50. What would be the best way
for P to store the frequencies?
A. An array of 50 numbers
B. An array of 100 numbers
C. An array of 500 numbers
D. A dynamically allocated array of 550 numbers
Answer: A
b) Which of the following operations is not O(1) for an array of sorted data. You may assume
that array elements are distinct.
A. Find the ith largest element
B. Delete an element
C. Find the ith smallest element
D. All of the above
Answer: B
Answer: B
d) Consider an array consisting of –ve and +ve numbers. What would be the worst case time
complexity of an algorithm to segregate the numbers having same sign altogether i.e all
+ve on one side and then all -ve on the other ?
A. O(N)
B. O(N Log N)
C. O(N * N)
D. O(N Log Log N)
Answer: A
e) Let A[1…n] be an array of n distinct numbers. If i < j and A[i] > A[j], then the pair (i, j) is
called an inversion of A. What is the expected number of inversions in any permutation on
n elements ?
A. n(n-1)/2
B. n(n-1)/4
C. n(n+1)/4
D. 2n[logn]
Answer: B
f) Consider a two dimensional array A[20][10]. Assume 4 words per memory cell, the base
address of array A is 100, elements are stored in row-major order and first element is
A[0][0]. What is the address of A[11][5] ?
A. 560
B. 460
C. 570
D. 575
Answer: A
g) Two matrices M1 and M2 are to be stored in arrays A and B respectively. Each array can be
stored either in row-major or column-major order in contiguous memory locations. The
time complexity of an algorithm to compute M1 × M2 will be
A. best if A is in row-major, and B is in column- major order
B. best if both are in row-major order
C. best if both are in column-major order
D. independent of the storage scheme
Answer: D
A. 15i+j+84
B. 15j+i+84
C. 10i+j+89
D. 10j+i+89
i) Records can be stored in an area of memory called ______ memory.
A. Dynamic
B. Static
C. Simple
D. Parallel
Answer: A
j) The number of elements n is called the length or _____ of the array and the number K
in A[K] is called subscript or the _______
A. Size and Variable
B. Size and Index
C. Upper bound and Variable
D. Upper bound and Index
Answer: B
Q.3
a) Consider the linear arrays A(10:100), B(-10:10) and C(20) find the number of elements in
each array.
b) Suppose a company keeps a linear array YEAR(1920:1984) such that YEAR[K] contains
the number of employees born in year K. Write a module to print the number of employees
in which no employee was born.
c) Suppose a company keeps a linear array YEAR(1920:1984) such that YEAR[K] contains the
number of employees born in year K. Write a module to print the years in which no
employee was born.
d) Using the bubble sort algorithm, find the number of comparisons C and the number of
interchanges D in letters PEOPLE.
e) Suppose multidimensional arrays A(-2:2,2:22) and B(1:8,-5:5,-10:5) find the length of each
dimensions and the number of elements in A and B.
f) Consider multidimensional array B(1:8,-5:5,-10:5), find the memory location of element
B[4,4,4] , assuming base(B)=400 and w=4 words per memory cell.
g) Write and explain binary search algorithm.
h) A college uses the student record structure of 200 students containing list of entries with
level number 1. Student 2. Name 3. First 3.Middle 4. Last 2. Major 2.SAT 3.Verbal 3. Math
2. GPA for 4 year 2.CUM(Cumulative grade point average,
i. How many elementary items are there in file.
ii. Access the major of eighth student
i) A college uses the student record structure of 200 students containing list of entries with
level number 1. Student 2. Name 3. First 3.Middle 4. Last 2. Major 2.SAT 3.Verbal 3.
Math 2. GPA for 4 year 2.CUM(Cumulative grade point average, Write: Name[15], CUM,
GPA[2],GPA[1,3]
j) Write and explain the memory representation of an array.
Sipna College of Engineering and Technology, Amravati
Department of Computer Science and Engineering
Session 2019-20
Unit :- 3 Year/Sem: Second/4th
Subject :- DATA STRUCTURES Subject Code: 4KS01
Question Q1 Q2 Q3
No a-j a-j a-j
Marks 1 Marks Each 2 Marks Each 4 Marks Each
CO
-Mappin CO-3
g
Q.1
a) In a Circuar linked list organization, insertion of records involves modification of?
A. one pointer
B. two pointers
C. multiple pointers
D. no pointers
ANSWER: B
b) Which of the following points is/are true about Linked List data structure when it is compared
with array
A. It is easy to insert and delete elements in Linked List
B. Random access is not allowed in a typical implementation of Linked Lists
C. The size of array has to be pre-decided, linked lists can change their size any time.
D. All of the above
ANSWER: D
c) You are given pointers to first and last nodes of a singly linked list, which of the following
operations are dependent on the length of the linked list?
A. Delete the first element
B. Insert a new element as a first element
C. Delete the last element of the list
D. Add a new element at the end of the list
ANSWER: C
d) 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: A
e) What would be the asymptotic time complexity to find an element in the linked list?
A. O(1)
B. O(n)
C. O(n2)
D. None
ANSWER: B
Answer: A
Answer: D
Answer:B
i) Which of the following is false about a doubly linked list?
A. We can navigate in both the directions
B. It requires more space than a singly linked list
C. The insertion and deletion of a node take a bit longer
D. Implementing a doubly linked list is easier than singly linked list
Answer: D
Q.2
a) Choose Correct option:
i) Searching a particular element in a linked list is always O(1)
ii) Linked list can grow and shrink in size depending upon the insertion and deletion that
occurs in the list
iii) Insertions and deletions at any place in a list can be handled easily and efficiently
iv) A linked list will use less storage space than an array to store the same number of elements
A. i & ii
B. ii & iii
C. iii & iv
D. i,ii,iii & iv
ANSWER: B
b) A situation where the user tries to delete a node from an empty linked list is termed as
_________ and when the users tries to insert a node and free storage list is empty then it is
called as ___________
A. deletion and insertion
B. underflow and overflow
C. overflow and underflow
D. insertion and deletion
ANSWER: B
c) Each node in a linked list has two pairs of ____________ and ____________.
A. Link field and information field
B. Link field and avail field
C. Avail field and information field
D. Address field and link field
ANSWER: A
____________________________________________________________________
Else
Set LOC:=NULL and EXIt
[End of If structure]
[ End of Step 2 ]
Step 4: Set LOC:=NULL
Step 5: Exit
Choose options to complete the algorithm
ANSWER: B
f) Which of the following sorting algorithms can be used to sort a random linked list with
minimum time complexity?
A. Insertion Sort
B. Quick Sort
C. Heap Sort
D. Merge Sort
Answer: D
g) What are the time complexities of finding 8th element from beginning and 8th element from
end in a singly linked list?
Let n be the number of nodes in linked list, you may assume that n > 8.
h) The concatenation of two lists is to be performed in O(1) time. Which of the following
implementations of a list should be used?
A. singly linked list
B. doubly linked list
C. circular doubly linked list
D. array implementation of lists
Answer: C
i) Is it possible to create a doubly linked list using only one pointer with every node.
A. Not Possible
B. Yes, possible by storing XOR of addresses of previous and next nodes.
C. Yes, possible by storing XOR of current node and next node
D. Yes, possible by storing XOR of current node and previous node
Answer: (B)
j) In a doubly linked list, the number of pointers affected for an insertion operation will be
A. 4
B. 0
C. 1
D. None of these
Answer: D
Q.3
a) Define Linked list with Example.
b) Write and Explain searching Algorithm for sorted linked list with Example.
c) Write and Explain searching Algorithm for unsorted linked list with Example.
d) Discuss the advantages of a two way linked list on a one way linked list.
e) Let LIST be a Linked list in memory. Write a procedure which finds the number of nonzero
elements in LIST.
f) Let LIST be a Linked list in memory. Write a procedure which finds the number of times a
given ITEMS occur in LIST.
g) Explain doubly linked list with example.
h) Explain insertion algorithm for two way linked list
i) Explain deletion algorithm for two way linked list.
j) Write and explain algorithm for insertion of a node after a given node.
Sipna College of Engineering and Technology, Amravati
Department of Computer Science and Engineering
Session 2019-20
Unit :- IV Year/Sem: Second/4th
Subject :- DATA STRUCTURES Subject Code: 4KS01
Question Q1 Q2 Q3
No a-j a-j a-j
Marks 1 Marks Each 2 Marks Each 4 Marks Each
CO
-Mappin CO-4
g
Q.1
a. How many stacks are needed to implement a queue. Consider the situation where no other data
structure like arrays, linked list is available to you.
A. 1
B. 2
C. 3
D. 4
ANSWER: B
b. Which of the following is essential for converting an infix expression to the postfix form
efficiently?
A. An operator Stack
B. An operand Stack
C. An operand Stack and an operator stack
D. Parse tree
ANSWER: A
d. __________________ is a linear list in which items may be added only at one end and items
may be removed only at the other end.
A. Queue
B. Recursion
C. Stack
D. Linear list
ANSWER: A
e. Which of the following is true about linked list implementation of queue?
A. In push operation, if new nodes are inserted at the beginning of linked list, then in pop
operation, nodes must be removed from end.
B. In push operation, if new nodes are inserted at the end, then in pop operation, nodes must
be removed from the beginning.
C. Both of the above
D. None of the above
Answer: C
f. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in
what order will they be removed?
A. ABCD
B. DCBA
C. DCAB
D. ABCD
ANSWER: A
g. In the array implementation of circular queue, which of the following operation take worst case
linear time?
A. Insertion
B. Deletion
C. To empty a queue
D. None
ANSWER: D
h. In linked list implementation of queue, if only front pointer is maintained, which of the
following operation take worst case linear time?
A. Insertion
B. Deletion
C. To empty a queue
D. Both a) and c)
ANSWER: D
i. A circular queue is implemented using an array of size 10. The array index starts with 0, front
is 6, and rear is 9. The insertion of next element takes place at the array index.
A. 0
B. 7
C. 9
D. 10
ANSWER: A
j. 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
ANSWER: A
Q.2
a. The result evaluating the postfix expression
10, 5, +, 60, 6, /, *, 8, -
A. 284
B. 213
C. 142
D. 71
ANSWER: C
Answer: C
h. Consider a standard Circular Queue ‘q’ implementation (which has the same condition for
Queue Full and Queue Empty) whose size is 11 and the elements of the queue are q[0], q[1],
q[2]…..,q[10].The front and rear pointers are initialized to point at q[2] . In which position will
the ninth element be added?
A. q[0]
B. q[1]
C. q[9]
D. q[10]
Answer: A
i. Let the following circular queue can accommodate maximum six elements with the following
data
front = 2 rear = 4
queue = _______; L, M, N, ___, ___
What will happen after ADD O operation takes place?
A. front = 2 rear = 5
queue = ______; L, M, N, O, ___
B. front = 3 rear = 5
queue = L, M, N, O, ___
C. front = 3 rear = 4
queue = ______,L, M, N, O, ___
D. front = 2 rear = 4
queue = L, M, N, O, ___
ANSWER: A
j. If the MAX_SIZE is the size of the array used in the implementation of circular queue, array
index start with 0, front point to the first element in the queue, and rear point to the last element
in the queue. Which of the following condition specify that circular queue is FULL?
A. Front=rear= -1
B. Front=(rear+1)%MAX_SIZE
C. Rear=front+1
D. Rear=(front+1)%MAX_SIZE
ANSWER: B
Q.3
a) Give significance of stack in short.
b) Explain insertion algorithm for Queue.
c) Explain in short Quicksort algorithm with example .
d) Evaluate postfix expression, P: 12,7,3,-,/,2,1,5,+,*,+
e) Translate infix expression into postfix ((A+B)*D) (E-F)
f) Translate infix expression into prefix (A+B D)/(E-F)+G
g) Suppose each data structure is stored in a circular array with N memory cells then find the
number of elements in a queue in terms of FRONT and REAR.
h) Suppose each data structure is stored in a circular array with N memory cells then find the
number of elements in a queue in terms of LEFT and RIGHT.
i) Suppose each data structure is stored in a circular array with N memory cells then when will
the queue be filled in terms of FRONT and REAR & LEFT and RIGHT.
j) A priority queue is implemented as a max-heap. Initially, it has five elements. The level-order
traversal of the heap is as follows:20, 18, 15, 13, 12
Two new elements ‘10’ and ‘17’ are inserted in the heap in that order. The level-order traversal
of the heap after the insertion of the element is:
(A) 20, 18, 17, 15, 13, 12, 10
(B) 20, 18, 17, 12, 13, 10, 15
(C) 20, 18, 17, 10, 12, 13, 15
(D) 20, 18, 17, 13, 12, 10, 15
Answer: (D)
Sipna College of Engineering and Technology, Amravati
Department of Computer Science and Engineering
Session 2019-20
Unit :- 5 Year/Sem: Second/4th
Subject :- DATA STRUCTURES Subject Code: 4KS01
MCQ (Question Bank)
Question Q1 Q2 Q3
No a-j a-j a-j
Marks 1 Marks Each 2 Marks Each 4 Marks Each
CO
CO-5
-Mapping
Q1)
a) The number of edges from the root to the node is called __________ of the tree.
i. Height
ii. Depth
iii. Length
iv. Width
Ans: ii
b) To obtain a prefix expression, which of the tree traversals is used?
i. Level-order traversal
ii. Pre-order traversal
iii. Post-order traversal
iv. In-order traversal
Ans: ii
c) Which of the following techniques represents the precise sequence of an In - Order Traversal of
a Binary Tree?
i. Visit the Root, Traverse Left Subtree, Traverse Right Subtree
ii. Traverse Left Subtree, Visit the Root, Traverse Right Subtree
iii. Traverse Left Subtree, Traverse Right Subtree, Visit the Root
iv. None of the Above
Ans: ii
d) The Inoder Traversal of a tree will yield a sorted listing of tree in
i. Binary search tree
ii. Binary tree
iii. Heap tree
iv. None of above
Ans: i
e) How many children does a binary tree have?
i. any number of children
ii. 2
iii. 0 or 1 or 2
iv. 0 or 1
Ans: iii
Q1)
f) A binary tree is a rooted tree but not an ordered tree.
i. True
ii. False
Ans: ii
g) If binary trees are represented in arrays, what formula can be used to locate a left child, if the
node has an index i?
i. 2*i
ii. 2*i+1
iii. 4*i
iv. 2*i+2
Ans: i
h) Which of the is false about a binary search tree?
i. The left child is always lesser than its parent
ii. The right child is always greater than its parent
iii. The left and right sub-trees should also be binary search trees
iv. In order sequence gives decreasing order of elements
Ans: iv
i) Heap can be used as ________________
i. Priority Queue
ii. Stack
iii. Decraesing order array
iv. Normal Array
Ans: i
j) For a binary tree the first node visited in in-order and post-order traversal is same.
i. True
ii. false
Ans: ii
Q2)
a) The pre-order and in-order are traversals of a binary tree are T M L N P O Q and L M N T O P Q.
Which of following is post-order traversal of the tree?
i. L N M O Q P T
ii. NMOPOLT
iii. LMNOPQT
iv. O P L M N Q T
Ans: ii
b) The following given tree is an example for? Ans:- i
i)
ii)
iii)
iv)
Ans:- iv
d) In Huffman coding, data in a tree always occur?
i. Leaves
ii. Root
iii. left sub trees
iv. Right sub trees
Ans:- i
e) In heap sort, after deleting the last minimum element, the array will contain elements in?
i. increasing sorting order
ii. decreasing sorting order
iii. tree inorder
iv. tree preorder
Ans:- ii
f) The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which
one of the following is the postorder traversal sequence of the same tree?
i. 10, 20, 15, 23, 25, 35, 42, 39, 30
ii. 15, 10, 25, 23, 20, 42, 35, 39, 30
iii. 15, 20, 10, 23, 25, 42, 35, 39, 30
iv. 15, 10, 23, 25, 20, 35, 42, 39, 30
Ans:- iv
g) Which of the following traversals is sufficient to construct BST from given traversals
1) Inorder 2) Preorder 3) Postorder
i. Any one of the given three traversals is sufficient
ii. Either 2 or 3 is sufficient
iii. 2 and 3
iv. 1 and 3
Ans:- ii
h) What is the worst case time complexity for search, insert and delete operations in a general Binary
Search Tree?
i. O(n) for all
ii. O(Logn) for all
iii. O(Logn) for search and insert, and O(n) for delete
iv. O(Logn) for search, and O(n) for insert and delete
Ans:- i
i) Which of the following statement about binary tree is CORRECT?
i. Every binary tree is either complete or full
ii. Every complete binary tree is also a full binary tree
iii. Every full binary tree is also a complete binary tree
iv. A binary tree cannot be both complete and full
Ans :- iii
j) The minimum number of elements in a heap of height h is
i. 2h+1
ii. 2h
iii. 2h -1
iv. 2h-1
Ans :- ii
Q3)
i. PQRSTUVWX
ii. WRSQPVTUX
iii. SWTQXUVRP
iv. STWUXVQRP
Ans :- iii
j) Consider the following data and specify which one is Preorder, inoder and postorder
S1:N,M,P,O,Q
S2:N,P,Q,O,M
S3: M, N, O, P, Q
i) S1 is preorder, S2 is inorder and S3 is postorder
ii) S1 is inorder, S2 is preorder and S3 is postorder
iii) S1 is inorder, S2 is postorder and S3 is preorder
iv) S1 is postorder, S2 is inorder and S3 is preorder
Ans :- iii
Sipna College of Engineering and Technology, Amravati
Department of Computer Science and Engineering
Session 2019-20
Unit :- 6 Year/Sem: Second/4th
Subject :- DATA STRUCTURES Subject Code: 4KS01
Question Q1 Q2 Q3
No a-j a-j a-j
Marks 1 Marks Each 2 Marks Each 4 Marks Each
CO
-Mappin CO-6
g
Q1.
a) An Adjacency matrix representation of graph cannot contain information of
a. Nodes
b. Edges
c. Direction of edes
d. Parallel edges
Answer : d
b) If every node in a graph G is adjacent to equal number of nodes then graph G is said to be
a. Finite
b. Complete
c. Regular
d. Strongly Connected
Answer : c
e) Which of the following statements is always correct for any 2 spanning tree for a graph
a. Sum of weight of edges is always same
b. Have same number of edges and Sum of weight of edges is always same
c. Selected vertices have same degree
d. Have same number of edges
Answer : d
g) What is the maximum number of possible non zero values in an adjacency matrix of a simple
graph with n vertices?
a. (n*(n-1))/2
b. (n*(n+1))/2
c. n*(n-1)
d. n*(n+1)
Answer: c
i) In a simple graph, the number of edges is equal to twice the sum of the degrees of the
vertices...
a. True
b. False
Answer : b
Q.2
a) Which of the following ways can be used to represent a graph?
a. Adjacency List and Adjacency Matrix
b. Incidence Matrix
c. Adjacency List, Adjacency Matrix as well as Incidence Matrix
d. None of the above
Answer : c
b) The time complexity to calculate the number of edges in a graph whose information in stored
in form of an adjacency matrix is ____________
a. O(V)
b. O(E)
c. O(V2)
d. O(E2)
Answer : c
d) Which of the following algorithms solves the all pair shortest path algorithm
a. Floyd’s Algorithm
b. Prims Algorithm
c. Djkstra Algorithm
d. Warshall Algorithm
Answer: a
e) Given an adjacency matrix A = [ [0, 1, 1], [1, 0, 1], [1, 1, 0] ], The total no. of ways in which
every vertex can walk to itself using 2 edges is ________
a. 2
b. 6
c. 4
d. 8
Answer: b
f) Which of the following graphs are isomorphic to each other?
Answer: d
g) What would be the DFS traversal of the given Graph?
…
a. ABCED
b. AEDCB
c. EDCBA
d. ADECB
Answer : a
h) What sequence would the BFS traversal of the given graph yield?
a. AFDBCE
b. CBAFED
c. A B D C E F
d. EFDCBA
Answer : c
i) For any two different vertices u and v of an Acyclic Directed Graph if v is reachable from u, u
is also reachable from v
a. True
b. False
Answer:- b
j) What is the value of the sum of the minimum in-degree and maximum out-degree of an
Directed Acyclic Graph?
a) Depends on a Graph
b) Will always be zero
c) Will always be greater than zero
d) May be zero or greater than zero
Answer:- b
Q.3
a) Write and Explain Warshall Algorithm with Example.
b) Write and Explain Shortest path (Djkstra) Algorithm with Example.
c) Write and Explain BFS Algorithm with Example.
d) Write and Explain DFS Algorithm with Example.
e) Write and Explain Insertion sort Algorithm with Example.
f) Write and Explain Selection sort Algorithm with Example.
g) Write and Explain Merge sort Algorithm with Example.
h) Write and Explain Radix sort Algorithm with Example.
h) Write and Explain Division Method with Example.
i) Write and Explain Mid-Square Method with Example.
j) Write and Explain Folding Method with Example.