Computer Science Theory

Description: This quiz covers fundamental concepts and theories in computer science, including algorithms, data structures, complexity analysis, and automata theory.
Number of Questions: 15
Created by:
Tags: computer science theory of computation algorithms data structures complexity analysis
Attempted 0/15 Correct 0 Score 0

Which sorting algorithm has a worst-case time complexity of O(n^2) but a best-case time complexity of O(n)?

  1. Bubble Sort

  2. Merge Sort

  3. Quick Sort

  4. Heap Sort


Correct Option: A
Explanation:

Bubble Sort has a worst-case time complexity of O(n^2) when the input is already sorted in reverse order, but it has a best-case time complexity of O(n) when the input is already sorted.

What is the time complexity of finding the minimum element in an unsorted array of size n?

  1. O(n)

  2. O(log n)

  3. O(n^2)

  4. O(1)


Correct Option: A
Explanation:

Finding the minimum element in an unsorted array requires examining all elements, resulting in a time complexity of O(n).

Which data structure is used to efficiently store and retrieve elements based on their priority?

  1. Queue

  2. Stack

  3. Heap

  4. Linked List


Correct Option: C
Explanation:

A heap is a data structure that maintains a partially ordered tree, allowing for efficient retrieval of the minimum or maximum element in logarithmic time.

What is the maximum number of edges in a graph with n vertices and no self-loops?

  1. n(n-1)

  2. n(n+1)

  3. n^2

  4. n^3


Correct Option: A
Explanation:

In a graph with n vertices and no self-loops, the maximum number of edges is n(n-1) because each vertex can be connected to every other vertex except itself.

Which algorithm is used to find the shortest path between two nodes in a weighted graph?

  1. Dijkstra's Algorithm

  2. Floyd-Warshall Algorithm

  3. Kruskal's Algorithm

  4. Prim's Algorithm


Correct Option: A
Explanation:

Dijkstra's Algorithm is used to find the shortest path between two nodes in a weighted graph by iteratively selecting the node with the smallest distance from the starting node.

What is the name of the theorem that states that any sufficiently large integer can be expressed as the sum of three primes?

  1. Goldbach's Conjecture

  2. Fermat's Last Theorem

  3. Euler's Theorem

  4. Chinese Remainder Theorem


Correct Option: A
Explanation:

Goldbach's Conjecture states that any sufficiently large integer can be expressed as the sum of three primes, but it remains unproven.

Which complexity class represents problems that can be solved in polynomial time?

  1. P

  2. NP

  3. NP-complete

  4. NP-hard


Correct Option: A
Explanation:

The complexity class P represents problems that can be solved by a deterministic Turing machine in polynomial time.

What is the name of the problem that asks whether a given Boolean formula is satisfiable?

  1. Traveling Salesman Problem

  2. Knapsack Problem

  3. 3-SAT Problem

  4. Hamiltonian Cycle Problem


Correct Option: C
Explanation:

The 3-SAT Problem asks whether a given Boolean formula in conjunctive normal form with three literals per clause is satisfiable.

Which algorithm is used to find the maximum flow in a network?

  1. Ford-Fulkerson Algorithm

  2. Kruskal's Algorithm

  3. Prim's Algorithm

  4. Dijkstra's Algorithm


Correct Option: A
Explanation:

The Ford-Fulkerson Algorithm is used to find the maximum flow in a network by iteratively finding augmenting paths and increasing the flow along those paths.

What is the name of the theory that studies the relationship between computation and information?

  1. Computability Theory

  2. Information Theory

  3. Complexity Theory

  4. Automata Theory


Correct Option: A
Explanation:

Computability Theory studies the limits of computation and the relationship between computation and information.

Which algorithm is used to find the connected components of a graph?

  1. Depth-First Search

  2. Breadth-First Search

  3. Kruskal's Algorithm

  4. Prim's Algorithm


Correct Option: A
Explanation:

Depth-First Search can be used to find the connected components of a graph by traversing the graph in a depth-first manner and identifying the connected components as the subgraphs that are reachable from each starting vertex.

What is the name of the theorem that states that any sufficiently large integer can be expressed as the sum of four squares?

  1. Goldbach's Conjecture

  2. Fermat's Last Theorem

  3. Euler's Theorem

  4. Lagrange's Four-Square Theorem


Correct Option: D
Explanation:

Lagrange's Four-Square Theorem states that any sufficiently large integer can be expressed as the sum of four squares.

Which complexity class represents problems that can be solved in exponential time?

  1. P

  2. NP

  3. NP-complete

  4. EXP


Correct Option: D
Explanation:

The complexity class EXP represents problems that can be solved by a deterministic Turing machine in exponential time.

What is the name of the problem that asks whether a given graph contains a Hamiltonian cycle?

  1. Traveling Salesman Problem

  2. Knapsack Problem

  3. 3-SAT Problem

  4. Hamiltonian Cycle Problem


Correct Option: D
Explanation:

The Hamiltonian Cycle Problem asks whether a given graph contains a Hamiltonian cycle, which is a cycle that visits every vertex exactly once.

Which algorithm is used to find the minimum spanning tree of a weighted graph?

  1. Kruskal's Algorithm

  2. Prim's Algorithm

  3. Dijkstra's Algorithm

  4. Floyd-Warshall Algorithm


Correct Option: A
Explanation:

Kruskal's Algorithm is used to find the minimum spanning tree of a weighted graph by iteratively adding edges to the tree in ascending order of weight.

- Hide questions