You are on page 1of 31

Sipna College of Engineering and Technology, Amravati

Department of Computer Science and Engineering


Session 2019-20
Unit :- 1 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
-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

c) Which of the following is non-linear data structure


a. Tree
b. Stack
c. Array
d. Queue
Answer: a

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

e) In a complexity theory ____________ cases refer to the expected value of f(n)


a. Good
b. Worst
c. Best
d. Average
Answer : d

f) Each step of algorithm may contain its _____________ in bracket


a. Puepose
b. function
c. Comment
d. Steps
Answer: c

g) String with Zero character is called __________ string


a. Binary
b. Null
c. List
d. Totaled
Answer: b

h) The number of character in String is called


a. Length
b. Breadth
c. Width
d. None of the above
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

c) Determine output of INSERT(‘AAAAA’,1 , ‘BBB’)


a. BBBAAAAA
b. ABBBAAAA
c. AAAAABBB
d. None of the above
Answer: a

d) Determine Output of the given function DELETE(‘AAABBB’,2,2)


a. AABB
b. AA
c. ABBB
d. None of the above
Answer: c

e) Determine Output of the given function DELETE(‘JOHN PAUL JONES’,6,5)


a. JOHN JONES
b. JONES PAUL
c. JOHN PAUL
d. None of the above
Answer: a
f) If S = “JOHN PAUL JONES” then determine length(s) and SUBSTRING(S,4,8)
a. 15 and ‘N PAUL J’
b. 15 and ‘NPAULJ’
c. fig 14 and ‘N PAUL J’
d. fig 14 and ‘NPAULJ’
Answer: a

g) If T = ababababab and P = abc then INDEX(T,P) = ?


a. 0
b. 1
c. 2
d. Null
Answer : a

h) If T = abaabbaaabbbaaaabbbb and P = aaa then INDEX(T,P) = ?


a. 0
b. 7
c. 1
d. None of the above
Answer : b

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

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
-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

b) Which of these best describes an array?

A. A data structure that shows a hierarchical behavior


B. Container of objects of similar types
C. Arrays are immutable once initialized
D. Array is not a data structure
Answer: B

c) Which of the following is a correct way to declare a multidimensional array in Java?

A. int[] arr;
B. int arr[[]];
C. int[][]arr;
D. int[[]] arr;
Answer: C

d) Which of the following concepts make extensive use of arrays?

A. Binary trees
B. Scheduling of processes
C. Caching
D. Spatial locality

Answer: D
e) What are the advantages of arrays?

A. Objects of mixed data types can be stored


B. Elements in an array cannot be sorted
C. Index of first element of an array is 1
D. Easier to store elements of same data type
Answer: D
f) What are the disadvantages of arrays?
A. Data structure like queue or stack cannot be implemented
B. There are chances of wastage of memory space if elements inserted in an array are lesser
than the allocated size
C. Index value of an array can be negative
D. Elements are sequentially accessed
Answer: B

g) Assuming int is of 4bytes, what is the size of int arr[15];?

A. 15
B. 19
C. 11
D. 60
Answer: D

h) In general, the index of the first element in an array is __________

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?

A. int arr[3] = (1,2,3);


B. int arr(3) = {1,2,3};
C. int arr[3] = {1,2,3};
D. int arr(3) = (1,2,3);

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

c) The minimum number of comparisons required to determine if an integer appears more


than n/2 times in a sorted array of n integers is
A. Θ(n)
B. Θ(logn)
C. Θ(log*n)
D. Θ(1)

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

h) Let A be a two dimensional array declared as follows:


A : array [ 1... 10] [1... 15] of integer;
Assuming that each integer takes one memory locations the array is stored in row-major
order and the first element of the array is stored at location 100, what is the address of
the element A[i] [j]?

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

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
-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

f)  What is the space complexity for deleting a linked list?


A. O(1)
B. O(n)
C. Either O(1) or O(n)
D. O(logn)

Answer: A

g) Which of these is not an application of linked list?


A. To implement file systems
B. For separate chaining in hash-tables
C. To implement non-binary trees
D. Random Access of elements

Answer: D

h) Linked list is generally considered as an example of _________ type of memory allocation.


A. None of these
B. Dynamic
C. Static
D. Compile Time

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

j) What is a memory efficient double linked list?


A. Each node has only one pointer to traverse the list back and forth
B. The list has breakpoints for faster traversal
C. An auxiliary singly linked list acts as a helper list to traverse through the doubly linked list
D. A doubly linked list that uses bitwise AND operator for storing addresse
Answer: A

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

d) Algorithm for traversing circular linked list


Step 1: Set _________________________________
Step2: Repeat Steps 3 & 4 While______________:
Step 3 : Apply Process to INFO[PTR]
Step 4: Set PTR:=LINK[PTR]
[End of step 2]
Step 5: Exit
Choose options to complete the algorithm

A. PTR:=START and PTR=LINK[START]


B. PTR:=START and PTR!=NULL
C. PTR:=LINK[START] and PTR!=START
D. PTR:=LINK[START] and PTR!=NULL
ANSWER: C

e) Algorithm for Searching sorted linked list


Step 1: Set PTR:=START
Step 2: Repeat Steps 3 While PTR!= NULL
Step 3: _______________________________
_________________________________________________________________

____________________________________________________________________
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

A. If ITEM>INFO[PTR], then: Set LOC:=PTR


Else if ITEM:=INFO[PTR], then: Set PTR:=LINK[PTR]
B. If ITEM>INFO[PTR], then: Set PTR:=LINK[PTR]
Else if ITEM:=INFO[PTR], then: Set LOC:=PTR and Exit
C. If ITEM>INFO[PTR], then: Set PTR:=LINK[PTR]
Else if ITEM:=INFO[PTR] Set LOC:=PTR and Exit
D. If ITEM>INFO[PTR], then: Set PTR:=LINK[PTR]
Else if ITEM:=INFO[PTR], then: Set LOC:=PTR

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.

A. O(1) and O(n)


B. O(1) and O(1)
C. O(n) and O(1)
D. O(n) and O(n)
Answer: (A)

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

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
-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

c. Which one of the following is an application of Queue Data Structure?


A. When a resource is shared among multiple consumers.
B. When data is transferred asynchronously (data not necessarily received at same rate as sent)
between two processes.
C. Load Balancing
D. All of the above
ANSWER: D

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

b. The following sequence of Operation is performed on a Stack:


PUSH(10),PUSH(20),POP,PUSH(10),PUSH(20),POP,POP,POP,PUSH(20),POP
The sequence of values popped out is:
A. 20, 10, 20, 10, 20
B. 20, 20, 10, 10, 20
C. 10,20,20,10,20
D. 20,20,10,20,10
ANSWER: B

c. Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n


elements. Assume that the insertion and deletion operation are carried out using REAR and
FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions
to detect queue full and queue empty are
A. Full: (REAR+1) mod n == FRONT, empty: REAR == FRONT
B. Full: (REAR+1) mod n == FRONT, empty: (FRONT+1) mod n == REAR
C. Full: REAR == FRONT, empty: (REAR+1) mod n == FRONT
D. Full: (FRONT+1) mod n == REAR, empty: REAR == FRONT
ANSWER: A

d. The postfix expression for the infix expression


A+B*(C+D)/F+D*E
A. AB+CD+*F/D+E*
B. ABCD+*F/+DE*+
C. A*B+CD/F*DE++
D. A+*BCD/F*DE++
ANSWER: B
e. Let x and y denote positive integers. Suppose a function P(x,y) is defined recursively as
follows:
P(x,y)=5 if x<y and
P(x,y)= P(x-y,y+2)+1 if x>=y
Find P (5,3) and P(15,2)
A. 5 and 7
B. 6 and 8
C. 5 and 8
D. 6 and 7
ANSWER: B

f. Suppose implementation supports an instruction REVERSE, which reverses the order of


elements on the stack, in addition to the PUSH and POP instructions. Which one of the
following statements is TRUE with respect to this modified stack?

A. A queue cannot be implemented using this stack.


B. A queue can be implemented where ENQUEUE takes a single instruction and DEQUEUE
takes a sequence of two instructions.
C. A queue can be implemented where ENQUEUE takes a sequence of three instructions and
DEQUEUE takes a single instruction.
D. A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction
each.
Answer: C

g. Which of the following option is not correct?


A. If the queue is implemented with a linked list, keeping track of a front pointer, Only rear
pointer s will change during an insertion into an non-empty queue.
B. Queue data structure can be used to implement least recently used (LRU) page fault
algorithm and Quick short algorithm.
C. Queue data structure can be used to implement Quick short algorithm but not least recently
used (LRU) page fault algorithm.
D. Both (A) and (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. Binary Tree iii) Fibonacci Tree


ii. Binary Search Tree iv) AVL Tree
c) Construct a binary tree using the following data. The preorder traversal of a binary tree is 1, 2, 5, 3, 4.
The inorder traversal of the same binary tree is 2, 5, 1, 4, 3.

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)

a) Write and explain Pre-order traversal Algorithm.


b) Write and explain In-order traversal Algorithm.
c) Write and explain Post-order traversal Algorithm.
d) Write and explain Huffman’s Algorithm with Example.
e) Write and explain Heap sort Algorithm with Example.
f) A binary search tree is generated by inserting in order the following integers:
50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24. The number of the node in the left sub-tree and right
sub-tree of the root, respectively, is
i. (4, 7)
ii. (7, 4)
iii. (8, 3)
iv. (3, 8)
g) The post-order traversal of a binary tree is O P Q R S T. Then possible pre-order traversal will
be ________
i. T Q R S O P
ii. TOQRPS
iii. TQOPSR
iv. T Q O S P R
Ans :- iii
h)  A binary search tree contains values 7, 8, 13, 26, 35, 40, 70, 75. Which one of the following is
a valid post-order sequence of the tree provided the pre-order sequence as 35, 13, 7, 8, 26, 70,
40 and 75?
i. 7, 8, 26, 13, 75, 40, 70, 35
ii.  26, 13, 7, 8, 70, 75, 40, 35
iii. 7, 8, 13, 26, 35, 40, 70, 75
iv. 8, 7, 26, 13, 40, 75, 70, 35
Ans:- iv
i) Find the postorder traversal of the binary tree shown below.

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

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
-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

c) The Data Structure required Breadth First Traversal on a graph is


a. Tree
b. Stack
c. Array
d. Queue
Answer: d

d) The Data Structure required Depth First Traversal on a graph is


a. Tree
b. stack
c. Array
d. Queue
Answer : b

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

f) Which of the following statements for a simple graph is correct?


a. Every path is a trail
b. Every trail is a path
c. Every trail is a path as well as every path is a trail
d. None of the mentioned
Answer: a

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

h) What is the number of edges present in a complete graph having n vertices


a. (n*(n+1))/2
b. (n*(n-1))/2
c. n
d. Information given is insufficient
Answer : b

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

j) Which of the following properties does a simple graph not hold?


a. Must be connected
b. Must be unweighted
c. Must have no loops or multiple edges
d. All of the Mentioned
Answer : a

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

c) A Complete graph can have


a. n^2 spanning trees
b. n^(n-2) spanning trees
c. n^(n+1) spanning trees
d. n^n spanning trees
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?

a. fig 1 and fig 2


b. fig 2 and fig 3
c. fig 1 and fig 3
d. fig 1, fig 2 and fig 3

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.

You might also like