Algorithms - 2nd Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Hazen_ice
H
Hazen_ice
Community Contributor
Quizzes Created: 1 | Total Attempts: 831
Questions: 15 | Attempts: 831

SettingsSettingsSettings
Algorithms - 2nd Quiz - Quiz

Algorithms - 2nd Quiz


Questions and Answers
  • 1. 

    Dijkstra's algorithm - is a solution to the _________________ shortest path problem in graph theory. 

    • A.

      Multiple Source

    • B.

      Double Source

    • C.

      None of the above

    Correct Answer
    C. None of the above
    Explanation
    Dijkstra's algorithm is a solution to the single-source shortest path problem in graph theory. It is used to find the shortest path between a single source vertex and all other vertices in a graph. The algorithm works by iteratively selecting the vertex with the smallest distance from the source and updating the distances of its adjacent vertices. This process continues until all vertices have been visited. Therefore, the correct answer is "None of the above" as neither "Multiple Source" nor "Double Source" accurately describe the problem that Dijkstra's algorithm solves.

    Rate this question:

  • 2. 

    Dijkstra's algorithm only can work for directed weighted graph.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    Dijkstra's algorithm can work for both directed and undirected weighted graphs. The algorithm finds the shortest path from a starting node to all other nodes in the graph, regardless of whether the graph is directed or undirected. The algorithm uses the weights of the edges to determine the shortest path, and it does not depend on the direction of the edges. Therefore, the statement that Dijkstra's algorithm only works for directed weighted graphs is false.

    Rate this question:

  • 3. 

    Which of the following case does not exist in complexity theory?

    • A.

      Best Case

    • B.

      Worst Case

    • C.

      Null Case

    • D.

      Average case

    Correct Answer
    C. Null Case
    Explanation
    The null case does not exist in complexity theory. In complexity theory, we analyze the performance of algorithms based on different scenarios or inputs. The best case refers to the scenario where the algorithm performs optimally, while the worst case represents the scenario where the algorithm performs the worst. The average case considers the average performance of the algorithm across all possible inputs. However, the null case does not have a specific meaning in complexity theory, as it does not represent any particular scenario or input.

    Rate this question:

  • 4. 

    Big-O notation is used to denote ______________

    • A.

      Reduction of functions

    • B.

      Growth of functions

    • C.

      None of the above

    Correct Answer
    B. Growth of functions
    Explanation
    Big-O notation is used to denote the growth of functions. It is a mathematical notation that describes the upper bound or worst-case scenario of the growth rate of a function. By using Big-O notation, we can analyze the efficiency and performance of algorithms and determine how they scale with input size. It helps in comparing different algorithms and choosing the most efficient one for a given problem.

    Rate this question:

  • 5. 

    A problem that can be solved with polynomial worst-case complexity is called _____________.

    • A.

      Tractable

    • B.

      Unsolvable

    • C.

      Intractable

    Correct Answer
    A. Tractable
    Explanation
    A problem that can be solved with polynomial worst-case complexity is called tractable. This means that there exists an algorithm that can solve the problem efficiently, with a runtime that grows at most polynomially with the size of the input. In other words, the problem is manageable and can be solved in a reasonable amount of time, making it tractable.

    Rate this question:

  • 6. 

    Worst case scenario for Mergesort is ----

    • A.

      O(n log(n))

    • B.

      O(n)

    • C.

      O(n^2)

    Correct Answer
    A. O(n log(n))
    Explanation
    The worst case scenario for Mergesort is O(n log(n)). This means that the time complexity of Mergesort in the worst case is proportional to the product of the number of elements to be sorted (n) and the logarithm of that number (log(n)). In other words, as the number of elements to be sorted increases, the time it takes to sort them increases at a logarithmic rate. This makes Mergesort an efficient sorting algorithm, especially for large datasets.

    Rate this question:

  • 7. 

    Which one has the fastest growth?

    • A.

      N*n*n*

    • B.

      N!

    • C.

      Nlog(n)

    Correct Answer
    B. N!
    Explanation
    The correct answer is n!. The factorial function (n!) has the fastest growth rate compared to the other options. As n increases, the value of n! increases at a much faster rate than n*n*n or nlog(n). This is because n! is calculated by multiplying all the positive integers from 1 to n, resulting in exponential growth. In contrast, n*n*n and nlog(n) have polynomial and logarithmic growth rates respectively, which are slower compared to the exponential growth of n!.

    Rate this question:

  • 8. 

    Which one is not the properties of algorithm?

    • A.

      Correctness

    • B.

      Finiteness

    • C.

      Infiniteness

    • D.

      Generality

    Correct Answer
    C. Infiniteness
    Explanation
    The property of "Infiniteness" does not apply to algorithms. Algorithms are step-by-step procedures that solve a specific problem within a finite number of steps. They have a clear and well-defined set of instructions, making them finite in nature. Infiniteness refers to the opposite, indicating an endless or infinite process, which is not a characteristic of algorithms.

    Rate this question:

  • 9. 

    Time and Space complexities are the prime concerns to measure efficiency of algorithm.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    This statement is true because time and space complexities are indeed important factors in determining the efficiency of an algorithm. Time complexity refers to the amount of time it takes for an algorithm to run, while space complexity refers to the amount of memory or storage space required by the algorithm. By analyzing these complexities, we can assess how well an algorithm performs and make informed decisions about its efficiency.

    Rate this question:

  • 10. 

    BFS and DFS follows _____________ and ________________ respectively.

    • A.

      LIFO and FILO

    • B.

      Push-Pop and Queue-Dequeue

    • C.

      FIFO and LIFO

    • D.

      None of the above

    Correct Answer
    C. FIFO and LIFO
    Explanation
    BFS (Breadth First Search) follows FIFO (First In First Out) order, where the nodes are explored in the order they were added to the queue. On the other hand, DFS (Depth First Search) follows LIFO (Last In First Out) order, where the nodes are explored by going as deep as possible before backtracking.

    Rate this question:

  • 11. 

    For snake game, we can use the following algorithms.

    • A.

      BFS

    • B.

      DFS

    • C.

      MST

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    The correct answer is "all of the above" because all three algorithms (BFS, DFS, and MST) can be used for the snake game.

    - Breadth-First Search (BFS) can be used to find the shortest path from the snake's current position to the food, ensuring that the snake takes the most direct route to its target.
    - Depth-First Search (DFS) can be used to explore all possible paths the snake can take, allowing for more strategic decision-making and potentially finding alternative routes to the food.
    - Minimum Spanning Tree (MST) algorithms can be used to create a connected graph of the game board, ensuring that the snake can reach any part of the board without getting trapped.

    Rate this question:

  • 12. 

    What is the running time of Dijkstra Algorithm?

    • A.

      O(|V|^4 + |E|)

    • B.

      O(|V|^2 + |E|)

    • C.

      None of the above

    Correct Answer
    B. O(|V|^2 + |E|)
    Explanation
    The running time of Dijkstra's algorithm is O(|V|^2 + |E|), where |V| represents the number of vertices and |E| represents the number of edges in the graph. This is because the algorithm iterates through each vertex in the graph, performing operations that take O(|V|) time. Additionally, for each vertex, it explores its adjacent edges, which takes O(|E|) time. Therefore, the overall time complexity is O(|V|^2 + |E|).

    Rate this question:

  • 13. 

    The following are the applications of Dijkstra Algorithm--

    • A.

      Routing

    • B.

      Shortest path finding

    • C.

      Traffic Optimization

    • D.

      All of the above

    Correct Answer
    D. All of the above
    Explanation
    The Dijkstra Algorithm is a popular graph traversal algorithm that is used for finding the shortest path between two nodes in a graph. It can be applied to various applications such as routing, where it helps in finding the optimal path for data packets to reach their destination. It is also used for shortest path finding, where it helps in determining the most efficient route between two locations. Additionally, the algorithm can be utilized for traffic optimization, where it aids in minimizing congestion and improving overall traffic flow. Thus, all of the given applications are valid uses of the Dijkstra Algorithm.

    Rate this question:

  • 14. 

    Time complexity refers algorithm's performance regarding space.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    The given statement is incorrect. Time complexity refers to the amount of time an algorithm takes to run, not its performance regarding space. Space complexity, on the other hand, refers to the amount of memory an algorithm requires to run. Therefore, the correct answer is False.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jul 24, 2013
    Quiz Created by
    Hazen_ice
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.