wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DAA Quiz 3/GLBITM

Total questions: 15

Worksheet time: 5mins

Name
Class
Date
1.

What is the purpose of the Convex Hull algorithm?

a)

To calculate the area of a polygon.

b)

To sort a list of points in ascending order.

c)

To find the nearest neighbor of a point.

d)

To find the smallest convex boundary enclosing a set of points.

2.

Explain the Greedy Method in the context of the Knapsack problem.

a)

The Greedy Method selects items randomly without considering their value or weight.

b)

The Greedy Method requires sorting items by weight before selection.

c)

The Greedy Method only considers the total weight of items without regard to their value.

d)

The Greedy Method selects items based on the highest value-to-weight ratio until the knapsack is full.

3.

List the steps involved in Prim's Algorithm for finding a Minimum Spanning Tree.

a)

Add all edges to the MST at once.

b)

Start with all vertices included.

c)

Select the largest edge connecting MST to non-MST.

d)

1. Start with an arbitrary vertex. 2. Find the smallest edge connecting MST to non-MST. 3. Add the edge and vertex to MST. 4. Repeat until all vertices are included.

4.

Describe the process of Kruskal's Algorithm.

a)

Kruskal's Algorithm sorts vertices and connects them directly.

b)

Kruskal's Algorithm uses a depth-first search to find cycles.

c)

Kruskal's Algorithm finds the maximum spanning tree by adding all edges.

d)

Kruskal's Algorithm finds the minimum spanning tree by sorting edges and adding them without forming cycles.

5.

What are some common applications of Dijkstra's Algorithm?

a)

Weather forecasting models

b)

Image processing algorithms

c)

Data compression techniques

d)

Common applications include network routing protocols (like OSPF), GPS navigation systems, and project planning (like PERT charts).

6.

How does the Bellman-Ford Algorithm differ from Dijkstra's Algorithm?

a)

Bellman-Ford is faster than Dijkstra's for all graphs.

b)

Dijkstra's can handle negative weights while Bellman-Ford cannot.

c)

Both algorithms require the same data structure for implementation.

d)

Bellman-Ford handles negative weights; Dijkstra's does not.

7.

Define a Minimum Spanning Tree and its significance in graph theory.

a)

A Minimum Spanning Tree is a subset of edges connecting all vertices in a graph with the minimum total edge weight.

b)

A Minimum Spanning Tree is a tree that includes all edges of a graph.

c)

A Minimum Spanning Tree is a cycle that connects all vertices in a graph.

d)

A Minimum Spanning Tree is a subset of edges that connects only some vertices in a graph.

8.

What is meant by a single source shortest path in graph algorithms?

a)

The shortest paths from a single vertex to only one other vertex in a graph.

b)

The shortest paths from a single source vertex to all other vertices in a graph.

c)

The paths from all vertices to a single source vertex in a graph.

d)

The longest paths from multiple sources to a single vertex in a graph.

9.

Explain the Dynamic Programming approach in solving the 0/1 Knapsack problem.

a)

The total weight of all items in the knapsack.

b)

The minimum value that can be obtained with the knapsack's capacity.

c)

The average value of items that can fit in the knapsack.

d)

The maximum value that can be obtained without exceeding the knapsack's capacity.

10.

What is the time complexity of Prim's Algorithm using an adjacency matrix?

a)

O(V)

b)

O(E log V)

c)

O(V^2)

d)

O(V log V)

11.

How does Kruskal's Algorithm ensure that no cycles are formed in the Minimum Spanning Tree?

a)

Kruskal's Algorithm randomly selects edges without checking for cycles.

b)

Kruskal's Algorithm only adds edges that are the shortest available.

c)

Kruskal's Algorithm ensures no cycles by using a union-find structure to check if adding an edge connects two vertices in the same component.

d)

Kruskal's Algorithm requires all edges to be connected before forming a tree.

12.

What is the main advantage of using Dijkstra's Algorithm over the Bellman-Ford Algorithm?

a)

Dijkstra's Algorithm can handle negative weights more effectively.

b)

Bellman-Ford is always faster than Dijkstra's Algorithm.

c)

Dijkstra's Algorithm guarantees the shortest path in all cases.

d)

Dijkstra's Algorithm is faster for graphs with non-negative weights.

13.

In what scenarios would you prefer the Bellman-Ford Algorithm?

a)

When the graph is unweighted and requires a simple traversal.

b)

When using Dijkstra's algorithm for shortest paths.

c)

When the graph is a tree structure without cycles.

d)

When dealing with graphs that have negative weight edges or when detecting negative weight cycles is necessary.

14.

What data structures are commonly used in implementing Dijkstra's Algorithm?

a)

Array, Graph

b)

Stack, Linked List

c)

Priority Queue, Adjacency List/Matrix

d)

Hash Table, Binary Tree

15.

How can the Fractional Knapsack problem be solved differently than the 0/1 Knapsack problem?

a)

The Fractional Knapsack problem can be solved using a greedy algorithm, while the 0/1 Knapsack problem requires dynamic programming.

b)

The 0/1 Knapsack problem can be solved using a greedy algorithm.

c)

The Fractional Knapsack problem can only be solved using brute force.

d)

The Fractional Knapsack problem cannot be solved optimally.