0% found this document useful (0 votes)
4 views30 pages

MFCS

Uploaded by

krishnan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
0% found this document useful (0 votes)
4 views30 pages

MFCS

Uploaded by

krishnan
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 30

What is the result of

2
3
+
3
2
2
3
+3
2
?
A) 11
B) 17
C) 19
D) 23
Answer: B) 17
2. Which of the following is a tautology?

𝑃
A)

𝑃
¬

P∧¬P

𝑃
B)

𝑃
¬

P∨¬P

𝑃
C)

𝑃
¬

P→¬P
D)
¬

𝑃
(

𝑄

)
¬(P∨Q)

𝑃
Answer: B)

𝑃
¬

P∨¬P
3. The principle of mathematical induction is used to prove:
A) Theorems about divisibility
B) Statements for all natural numbers
C) Statements for all real numbers
D) Probabilistic assertions
Answer: B) Statements for all natural numbers
4. What is the cardinality of the set
{
1
,
2
,
3
,
4
}
{1,2,3,4}?
A) 3
B) 4
C) 5
D) 6
Answer: B) 4
5. Which of the following is an example of a binary operation?
A) Addition
B) Exponentiation
C) Square root
D) Logarithm
Answer: A) Addition

𝑆
6. In set theory, the power set of a set

S is:

𝑆
A) The set of all subsets of

𝑆
B) The set of all elements of

S
C) The set of all elements in the universal set

𝑆
D) The set of all possible pairs of elements in

𝑆
Answer: A) The set of all subsets of

S
7. Which of the following is not a type of relation?
A) Reflexive
B) Symmetric
C) Transitive
D) Linear
Answer: D) Linear
8. What is the time complexity of accessing an element in an array by index?

𝑂
A)

(
1
)
O(1)

𝑂
B)

(
log

𝑛

)
O(logn)

𝑂
C)

𝑛
(
)
O(n)

𝑂
D)

𝑛
(

2
)
O(n
2
)

𝑂
Answer: A)

(
1
)
O(1)
9. Which type of graph traversal uses a queue?
A) Depth-first search (DFS)
B) Breadth-first search (BFS)
C) Topological sort
D) Binary search
Answer: B) Breadth-first search (BFS)
10. In graph theory, a graph with no cycles is called:
A) Connected
B) Directed
C) Acyclic
D) Weighted
Answer: C) Acyclic
11. What is the value of the factorial of 4 (4!)?
A) 12
B) 24
C) 30
D) 48
Answer: B) 24
12. Which of the following is a correct representation of a function?

𝑓
A)

𝑥
(

)
=
{
(
1
,
2
)
,
(
2
,
3
)
,
(
3
,
4
)
}
f(x)={(1,2),(2,3),(3,4)}

𝑓
B)

𝑥
(

)
=
{
(
1
,
2
)
,
(
1
,
3
)
,
(
2
,
4
)
}
f(x)={(1,2),(1,3),(2,4)}

𝑓
C)

𝑥
(

)
=
{
(
1
,
2
)
,
(
2
,
3
)
,
(
2
,
3
)
}
f(x)={(1,2),(2,3),(2,3)}

𝑓
D)

𝑥
(
)
=
{
(
1
,
2
)
,
(
3
,
4
)
,
(
2
,
4
)
}
f(x)={(1,2),(3,4),(2,4)}

𝑓
Answer: A)

𝑥
(

)
=
{
(
1
,
2
)
,
(
2
,
3
)
,
(
3
,
4
)
}
f(x)={(1,2),(2,3),(3,4)}
13. In Boolean algebra, which of the following is the identity element for AND
operation?
A) 0
B) 1
C) 2
D) -1
Answer: B) 1
14. Which combinatorial object is used to count the number of ways to arrange a
subset of items?
A) Permutations
B) Combinations
C) Factorials
D) Arrangements
Answer: B) Combinations
15. Which of the following is a prime number?
A) 21
B) 24
C) 29
D) 35
Answer: C) 29
16. In a directed graph, an edge from vertex A to vertex B is called:
A) An arc
B) A loop
C) A path
D) A cycle
Answer: A) An arc
17. The complexity of binary search in a sorted array is:

𝑂
A)

(
1
)
O(1)

𝑂
B)

(
log

𝑛

)
O(logn)

𝑂
C)

𝑛
(

)
O(n)

𝑂
D)

𝑛
(

log

𝑛

)
O(nlogn)

𝑂
Answer: B)

(
log

𝑛

)
O(logn)
18. Which of the following statements is false regarding a tree in graph theory?
A) A tree is a connected acyclic graph.

𝑛
B) A tree with

𝑛
n vertices has

1
n−1 edges.
C) Every node in a tree can have multiple parents.
D) Any two nodes in a tree are connected by exactly one path.
Answer: C) Every node in a tree can have multiple parents.
19. What is the sum of the first 5 natural numbers?
A) 10
B) 15
C) 20
D) 25
Answer: B) 15
20. The logical operator that outputs true if exactly one of its inputs is true is
called:
A) AND
B) OR
C) XOR
D) NOT
Answer: C) XOR

𝑓
21. The function

𝑥
(

𝑥
=

2
+

𝑥
2

+
1
f(x)=x
2
+2x+1 is a:
A) Linear function
B) Quadratic function
C) Exponential function
D) Logarithmic function
Answer: B) Quadratic function
22. Which data structure is typically used to implement a LIFO (Last In First Out)
principle?
A) Queue
B) Stack
C) Array
D) Linked List
Answer: B) Stack

𝑛
23. What is the maximum number of edges in a simple undirected graph with

n vertices?

𝑛
A)

𝑛
B)

𝑛
(


1
)
2
2
n(n−1)

𝑛
C)

2
n
2

𝑛
D)

3
n
3

𝑛
Answer: B)

𝑛
(


1
)
2
2
n(n−1)

24. Which of the following is not a property of an equivalence relation?


A) Reflexive
B) Symmetric
C) Transitive
D) Anti-symmetric
Answer: D) Anti-symmetric
25. The complement of the set
{
1
,
2
,
3
}
{1,2,3} in a universal set
{
1
,
2
,
3
,
4
,
5
}
{1,2,3,4,5} is:
A)
{
4
,
5
}
{4,5}
B)
{
1
,
2
,
3
}
{1,2,3}
C)
{
4
,
5
,
6
}
{4,5,6}
D)
{
1
,
2
}
{1,2}
Answer: A)
{
4
,
5
}
{4,5}
26. In combinatorics, the number of ways to choose 2 objects from 5 distinct
objects is:
A) 10
B) 20
C) 25
D) 30
Answer: A) 10
27. Which of the following is not a valid method for solving recurrence relations?
A) Substitution
B) Characteristic equation
C) Iteration
D) Binary search
Answer: D) Binary search
28. **In set theory

You said:
more
ChatGPT said:
ChatGPT
Sure, here are more MCQs:
𝐴
28. In set theory, the intersection of two sets

𝐵
A and

B is:

𝐴
A) The set of elements that are in

𝐵
A or

𝐴
B) The set of elements that are in both

𝐵
A and

𝐴
C) The set of elements that are in

𝐵
A but not in

𝐵
D) The set of elements that are in

𝐴
B but not in

𝐴
Answer: B) The set of elements that are in both

𝐵
A and

𝑛
29. What is the minimum number of edges required to connect

n vertices in a connected graph?

𝑛
A)


1
n−1

𝑛
B)

𝑛
C)

𝑛
(


1
)
2
2
n(n−1)

𝑛
D)

𝑛
(


1
)
n(n−1)

𝑛
Answer: A)


1
n−1
30. Which of the following logical operators is associative?
A) AND
B) OR
C) XOR
D) Both A and B
Answer: D) Both A and B

𝑂
31. The time complexity of an algorithm that runs in

𝑛
(

2
)
O(n
2
) is best described as:
A) Linear
B) Logarithmic
C) Quadratic
D) Cubic
Answer: C) Quadratic
32. In a directed acyclic graph (DAG), which algorithm is typically used to find
the shortest path from a source vertex to all other vertices?
A) Depth-First Search (DFS)
B) Breadth-First Search (BFS)
C) Dijkstra’s Algorithm
D) Topological Sort
Answer: D) Topological Sort
33. Which of the following is a characteristic of a binary tree?
A) Each node can have up to three children
B) Each node can have at most two children
C) Each node can have an arbitrary number of children
D) Each node can have only one child
Answer: B) Each node can have at most two children
34. In graph theory, a Hamiltonian path visits:
A) All vertices exactly once
B) All edges exactly once
C) Some vertices exactly once
D) Some edges exactly once
Answer: A) All vertices exactly once
35. Which principle states that if there are more items than containers and each
item is placed into a container, then at least one container must contain more than
one item?
A) Principle of Inclusion-Exclusion
B) Pigeonhole Principle
C) Principle of Mathematical Induction
D) Principle of Superposition
Answer: B) Pigeonhole Principle
36. What is the result of the expression
¬

𝑃
(


𝑄
)
¬(P∨Q)?
A)

𝑃
¬

𝑄
¬

¬P∧¬Q
B)

𝑃
¬

𝑄
¬

¬P∨¬Q

𝑃
C)

𝑄

P∧Q

𝑃
D)

𝑄

P∨Q
Answer: A)

𝑃
¬

𝑄
¬

¬P∧¬Q
37. What is the time complexity of accessing an element in a hash table?

𝑂
A)

(
1
)
O(1) on average

𝑂
B)

(
log

𝑛

)
O(logn)

𝑂
C)

𝑛
(

)
O(n)

𝑂
D)

𝑛
(
log

𝑛

)
O(nlogn)

𝑂
Answer: A)

(
1
)
O(1) on average

𝑓
38. In a function

𝐴
:

𝐵

𝐵
f:A→B, if every element of

𝐴
B is the image of at most one element of

A, the function is called:


A) One-to-one
B) Onto
C) Bijective
D) Many-to-one
Answer: A) One-to-one

𝑛
39. The process of finding the number of permutations of

𝑟
n distinct objects taken

r at a time is given by:

𝑛
A)

𝐶
𝑟
nCr

𝑛
B)

𝑃
𝑟
nPr

𝑛
C)

!
n!

𝑛
D)

𝑛
(

𝑟

)
!
(n−r)!
n!
𝑛
Answer: B)

𝑃
𝑟
nPr
40. Which of the following is a valid method for solving systems of linear
equations?
A) Gaussian Elimination
B) Binary Search
C) Bubble Sort
D) Depth-First Search
Answer: A) Gaussian Elimination

𝑃
41. In Boolean algebra, which of the following expressions is equivalent to

𝑃
(

𝑄

)
P∧(P∨Q)?

𝑃
A)

𝑄
B)

𝑃
C)

𝑄

P∨Q
D)

𝑃
¬

𝑄

¬P∧Q

𝑃
Answer: A)

P
42. What is the primary purpose of a hashing function?
A) To sort data
B) To map data to a fixed-size value
C) To search data in a binary tree
D) To perform arithmetic operations
Answer: B) To map data to a fixed-size value
43. Which of the following operations is used to check if a set is a subset of
another set?
A) Union
B) Intersection
C) Difference
D) Subset Test
Answer: D) Subset Test

𝑛
44. In a complete binary tree with

n nodes, the height of the tree is:


A)
log

𝑛
2

log
2

n
B)
log

2

𝑛
(

+
1
)
log
2

(n+1)

𝑛
C)

2
2
n

𝑛
D)


1
n−1
Answer: B)
log

2

𝑛
(

+
1
)
log
2

(n+1)
45. The principle of inclusion-exclusion is used to:
A) Count the number of elements in the union of several sets
B) Count the number of elements in the intersection of several sets
C) Count the number of elements in the complement of a set
D) Find the probability of mutually exclusive events
Answer: A) Count the number of elements in the union of several sets
46. In a binary search tree, which traversal method produces a sorted order of
elements?
A) Pre-order
B) In-order
C) Post-order
D) Level-order
Answer: B) In-order
47. What is the purpose of a binary heap?
A) To sort data
B) To implement a priority queue
C) To perform binary search
D) To calculate factorials
Answer: B) To implement a priority queue
48. Which of the following is a correct definition of a bijective function?
A) A function that is both injective and surjective
B) A function that is only injective
C) A function that is only surjective
D) A function with no inputs
Answer: A) A function that is both injective and surjective

𝑛
49. The time complexity of matrix multiplication for two

𝑛
×

n×n matrices is:

𝑂
A)

𝑛
(

)
O(n)

𝑂
B)

𝑛
(

2
)
O(n
2
)

𝑂
C)

𝑛
(

3
)
O(n
3
)

𝑂
D)

𝑛
(

4
)
O(n
4
)

𝑂
Answer: C)

𝑛
(

3
)
O(n
3
)
50. In combinatorics, the number of ways to arrange
𝑛
n distinct objects is:

𝑛
A)

!
n!

𝑛
B)

!
2
!
2!
n!

𝑛
C)

𝑛
(

𝑟

)
!
(n−r)!
n!

𝑛
D)

2
n
2

𝑛
Answer: A)

!
n!

𝐴
51. Which of the following represents the Cartesian product of two sets

𝐵
A and

B?

𝐴
A)

𝐵

A∪B

𝐴
B)

𝐵

A∩B

𝐴
C)

𝐵
×

A×B
D)
𝐴

𝐵

A−B

𝐴
Answer: C)

𝐵
×

A×B

𝑆
52. What is the correct notation for the set of all subsets of a set

S?

𝑃
A)

𝑆
(

)
P(S)

𝑈
B)

𝑆
(

)
U(S)

𝐶
C)

𝑆
(

)
C(S)

𝑅
D)

𝑆
(

)
R(S)

𝑃
Answer: A)

𝑆
(

)
P(S)
53. Which of the following describes a bijective function?
A) A function where every element in the domain maps to exactly one element in the
codomain and every element in the codomain is mapped from exactly one element in
the domain
B) A function where every element in the domain maps to exactly one element in the
codomain
C) A function where some elements in the domain map to multiple elements in the
codomain
D) A function where every element in the codomain is mapped from multiple elements
in the domain
Answer: A) A function where every element in the domain maps to exactly one element
in the codomain and every element in the codomain is mapped from exactly one
element in the domain
54. In set theory, what is the difference between the union and intersection of two
sets?
A) Union gives all elements that are in either set, while intersection gives only
elements common to both sets
B) Union gives all elements common to both sets, while intersection gives elements
that are in either set
C) Union and intersection are the same operation
D) Union is a subset of intersection
Answer: A) Union gives all elements that are in either set, while intersection
gives only elements common to both sets
55. The time complexity of the quicksort algorithm in the average case is:

𝑂
A)

(
1
)
O(1)

𝑂
B)

(
log

𝑛

)
O(logn)

𝑂
C)

𝑛
(

log

𝑛

)
O(nlogn)

𝑂
D)

𝑛
(

2
)
O(n
2
)

𝑂
Answer: C)

𝑛
(

log

𝑛

)
O(nlogn)

𝑂
56. What does the Big-O notation

𝑛
(

2
)
O(n
2
) represent?
A) Constant time complexity
B) Logarithmic time complexity
C) Linear time complexity
D) Quadratic time complexity
Answer: D) Quadratic time complexity
57. In graph theory, a graph where each pair of vertices is connected by an edge is
called:
A) A bipartite graph
B) A complete graph
C) A cyclic graph
D) An acyclic graph
Answer: B) A complete graph
58. Which of the following is not a type of traversal for binary trees?
A) Pre-order
B) In-order
C) Post-order
D) Level-order
E) Breadth-first
F) Depth-first
Answer: E) Breadth-first
59. What is the space complexity of an algorithm that uses a constant amount of
extra space regardless of the input size?

𝑂
A)

(
1
)
O(1)

𝑂
B)

𝑛
(

)
O(n)

𝑂
C)

𝑛
(

2
)
O(n
2
)

𝑂
D)

(
log

𝑛

)
O(logn)

𝑂
Answer: A)

(
1
)
O(1)
60. Which of the following data structures is used for implementing recursive
function calls?
A) Queue
B) Array
C) Stack
D) Linked List
Answer: C) Stack

𝑛
61. What is the number of edges in a tree with

n vertices?

𝑛
A)

𝑛
B)


1
n−1

𝑛
C)

+
1
n+1
D)
2

𝑛
(


1
)
2(n−1)

𝑛
Answer: B)


1
n−1
62. Which of the following describes the concept of an identity function?
A) A function that maps each element to itself
B) A function that maps every element in the domain to a unique element in the
codomain
C) A function that maps elements in the domain to all elements in the codomain
D) A function that has no outputs
Answer: A) A function that maps each element to itself
63. In a directed graph, a path that visits every edge exactly once is called:
A) Eulerian Path
B) Hamiltonian Path
C) Hamiltonian Cycle
D) Eulerian Circuit
Answer: A) Eulerian Path
64. Which sorting algorithm is based on the divide and conquer strategy?
A) Bubble Sort
B) Selection Sort
C) Merge Sort
D) Insertion Sort
Answer: C) Merge Sort

𝐴
65. In set theory,\ if

𝐵

𝐴
A⊆B, what is the relationship between

𝐵

𝐵
A∪B and

B?

𝐴
A)

𝐵

𝐵
=

A∪B=B

𝐴
B)

𝐵

𝐴
=

A∪B=A

𝐴
C)

𝐵

𝐴
=

𝐵

A∪B=A∩B

𝐴
D)

𝐵

𝐴
=

𝐵

A∪B=A−B

𝐴
Answer: A)

𝐵

𝐵
=

A∪B=B
66. Which of the following algorithms is used for finding the shortest path in a
weighted graph with positive edge weights?
A) Dijkstra’s Algorithm
B) Bellman-Ford Algorithm
C) Floyd-Warshall Algorithm
D) Kruskal’s Algorithm
Answer: A) Dijkstra’s Algorithm
67. Which of the following is an example of a non-linear data structure?
A) Array
B) Linked List
C) Stack
D) Tree
Answer: D) Tree
68. What is the time complexity of performing a search operation in a balanced
binary search tree?

𝑂
A)
(
1
)
O(1)

𝑂
B)

(
log

𝑛

)
O(logn)

𝑂
C)

𝑛
(

)
O(n)

𝑂
D)

𝑛
(

log

𝑛

)
O(nlogn)

𝑂
Answer: B)

(
log

𝑛

)
O(logn)

𝑛
69. Which of the following is true about the depth of a binary tree with

n nodes?

𝑛
A) The depth can be at most

n
B) The depth can be at most
log

𝑛
2

log
2

𝑛
C) The depth can be at most

𝑛
D) The depth can be at most

/
2
n/2

𝑛
Answer: A) The depth can be at most

𝑟
70. In combinatorics, the number of ways to choose

𝑛
r items from

n items without regard to order is represented by:


A) Permutations
B) Combinations
C) Factorials
D) Arrangements
Answer: B) Combinations
71. What is the Big-O notation for the time complexity of an algorithm that
performs a constant number of operations?

𝑂
A)

(
log

𝑛

)
O(logn)

𝑂
B)

𝑛
(

)
O(n)

𝑂
C)

𝑛
(

log

𝑛

)
O(nlogn)

𝑂
D)

(
1
)
O(1)

𝑂
Answer: D)

(
1
)
O(1)
72. Which of the following is not a type of graph traversal?
A) Depth-First Search (DFS)
B) Breadth-First Search (BFS)
C) Iterative Search
D) Topological Sort
Answer: C) Iterative Search
73. Which property must a graph satisfy to be a bipartite graph?
A) It must have an even number of vertices
B) It must be acyclic
C) Its vertices can be divided into two disjoint sets such that no two graph
vertices within the same set are adjacent
D) All vertices must be connected
Answer: C) Its vertices can be divided into two disjoint sets such that no two
graph vertices within the same set are adjacent
74. What does a depth-first search (DFS) algorithm use to keep track of the
vertices to be explored next?
A) Queue
B) Stack
C) Priority Queue
D) Array
Answer: B) Stack
75. Which of the following is true for an NP-complete problem?
A) It can be solved in polynomial time
B) Any problem in NP can be reduced to it in polynomial time
C) It is easier than an NP-hard problem
D) It is a problem that has no solution
Answer: B) Any problem in NP can be reduced to it in polynomial time

𝐾
76. What is the number of edges in a complete bipartite graph

𝑛
,

K
m,n

𝑚
A)

𝑛
×

m×n

𝑚
B)

𝑛
+

m+n
C)

𝑚
(

𝑛
+

𝑚
(

𝑛
+


1
)
2
2
(m+n)(m+n−1)

𝑚
D)

2
𝑛
+

2
m
2
+n
2

𝑚
Answer: A)

𝑛
×

m×n
77. Which of the following statements is true about a heap data structure?
A) It can be represented using a binary search tree
B) It is always a complete binary tree
C) It can be used to implement a stack
D) It supports efficient insertions and deletions but not searching
Answer: B) It is always a complete binary tree

𝑃
78. What is the result of the expression

𝑃
¬

P∨¬P in Boolean algebra?


A) True
B) False

𝑃
C)

P
D)

𝑃
¬

¬P
Answer: A) True
79. Which of the following data structures uses the Last In First Out (LIFO)
principle?
A) Queue
B) Stack
C) Array
D) Linked List
Answer: B) Stack
80. What is the time complexity of accessing an element in a linked list?

𝑂
A)

(
1
)
O(1)

𝑂
B)

(
log

𝑛

)
O(logn)

𝑂
C)
𝑛
(

)
O(n)

𝑂
D)

𝑛
(

2
)
O(n
2
)

𝑂
Answer: C)

𝑛
(

)
O(n)
81. Which of the following algorithms is used to find the minimum spanning tree of
a graph?
A) Prim’s Algorithm
B) Dijkstra’s Algorithm
C) Bellman-Ford Algorithm
D) Floyd-Warshall Algorithm
Answer: A) Prim’s Algorithm
82. What does a Breadth-First Search (BFS) algorithm use to keep track of the
vertices to be explored next?
A) Stack
B) Queue
C) Priority Queue
D) Array
Answer: B) Queue
83. Which of the following is a property of a tree data structure?
A) It has cycles
B) It has exactly one path between any two nodes
C) All nodes are at the same level
D) It can be represented as a graph with no edges
Answer: B) It has exactly one path between any two nodes
84. In graph theory, what is a spanning tree?
A) A tree that spans all the vertices in a graph
B) A tree that spans all the edges in a graph
C) A tree that is a subset of a complete graph
D) A tree with exactly one cycle
Answer: A) A tree that spans all the vertices in a graph
85. Which of the following is an example of a linear data structure?
A) Graph
B) Tree
C) Queue
D) Heap
Answer: C) Queue

𝑛
86. What is the space complexity of storing a binary tree with

n nodes?

𝑂
A)

(
1
)
O(1)

𝑂
B)

𝑛
(

)
O(n)

𝑂
C)

𝑛
(

log

𝑛

)
O(nlogn)

𝑂
D)

𝑛
(

2
)
O(n
2
)

𝑂
Answer: B)

𝑛
(

)
O(n)
87. Which algorithm is used to find the shortest path in a graph with negative edge
weights?
A) Dijkstra’s Algorithm
B) Bellman-Ford Algorithm
C) Kruskal’s Algorithm
D) Prim’s Algorithm
Answer: B) Bellman-Ford Algorithm
88. What is the purpose of a priority queue?
A) To retrieve elements in the order they were added
B) To retrieve the element with the highest (or lowest) priority
C) To sort elements
D) To store elements in a fixed-size array
Answer: B) To retrieve the element with the highest (or lowest) priority
89. Which of the following operations is not typically supported by a queue?
A) Enqueue
B) Dequeue
C) Peek
D) Pop
Answer: D) Pop
90. In a binary search tree, the time complexity for insertion, deletion, and
search operations is:

𝑂
A)

(
1
)
O(1)
B)
𝑂
(
log

𝑛

)
O(logn)

𝑂
C)

𝑛
(

)
O(n)

𝑂
D)

𝑛
(

2
)
O(n
2
)

𝑂
Answer: B)

(
log

𝑛

)
O(logn)
91. Which of the following is true about a graph that is strongly connected?
A) There is a path from every vertex to every other vertex
B) It is a complete graph
C) It has no cycles
D) It is a bipartite graph
Answer: A) There is a path from every vertex to every other vertex
92. In the context of recursion, what is a base case?
A) The case where the recursion continues indefinitely
B) The case where the recursion terminates
C) The case where recursion is optimized
D) The case where recursion is initialized
Answer: B) The case where the recursion terminates
93. Which algorithm is used for finding the shortest path in a graph where all
edges have equal weight?
A) Dijkstra’s Algorithm
B) Bellman-Ford Algorithm
C) Floyd-Warshall Algorithm
D) Breadth-First Search (BFS)
Answer: D) Breadth-First Search (BFS)
94. Which of the following data structures is not typically used for implementing a
priority queue?
A) Binary Heap
B) Binary Search Tree
C) Hash Table
D) Fibonacci Heap
Answer: C) Hash Table
95. In graph theory, what is a cut in a graph?
A) A partition of the graph’s vertices into two disjoint subsets
B) A subset of the graph’s edges
C) A path between two vertices
D) A subset of the graph’s vertices
Answer: A) A partition of the graph’s vertices into two disjoint subsets
96. What is the principle of mathematical induction used for?
A) To prove the correctness of an algorithm
B) To establish that a property holds for all natural numbers
C) To compute factorials
D) To sort elements in an array
Answer: B) To establish that a property holds for all natural numbers
97. Which of the following sorting algorithms is based on the principle of divide

𝑂
and conquer and has a time complexity of

𝑛
(

log

𝑛

)
O(nlogn) in the worst case?
A) Bubble Sort
B) Merge Sort
C) Insertion Sort
D) Selection Sort
Answer: B) Merge Sort
98. In which data structure can the elements be inserted or removed only from one
end?
A) Queue
B) Stack
C) Linked List
D) Array
Answer: B) Stack
99. What is the key difference between a stack and a queue?
A) Stack follows FIFO (First In First Out), while Queue follows LIFO (Last In First
Out)
B) Stack follows LIFO (Last In First Out), while Queue follows FIFO (First In First
Out)
C) Stack can only hold integers, while Queue can hold any data type
D) Stack and Queue are the same data structure
Answer: B) Stack follows LIFO (Last In First Out), while Queue follows FIFO (First
In First Out)
100. Which of the following is true about a cycle in a graph?
A) It is a path that starts and ends at the same vertex and contains no repeated
edges
B) It is a path that connects all the vertices in the graph
C) It is an edge that connects two vertices
D) It is a subset of the graph that contains all edges
Answer: A) It is a path that starts and ends at the same vertex and contains no
repeated edges

You might also like