Any2Quiz
Quizzes / CBSE / Class 12 / Computer Science / Programming

Algorithms Quiz - CBSE Class 12 Computer Science

Free practice quiz: Algorithms (CBSE Class 12 Computer Science). 10 multiple-choice questions with answers and explanations. Play online, no sign-up needed.

This CBSE Class 12 Computer Science practice quiz has 10 multiple-choice questions on Algorithms, and 10 of them come with an explanation. Try the 5 sample questions below (tap an option to check yourself), then play the full quiz online. No sign-up needed.

Start quiz: 10 questions, free

Sample questions

  1. What is the time complexity of linear search?

    Show answer

    Answer: C. O(n)

    Linear search checks each element one by one, resulting in a time complexity of O(n).

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

    Show answer

    Answer: D. Bubble Sort

    Bubble Sort has a worst-case time complexity of O(n^2) when the input is reverse sorted.

  3. Explain the difference between recursive and iterative algorithms.

    Show answer

    Answer: B. Recursive algorithms use function calls, while iterative algorithms use loops.

    Recursive algorithms solve a problem by breaking it down into smaller subproblems of the same type, while iterative algorithms use loops to repeat a block of code.

  4. Describe Dijkstra's algorithm and its application.

    Show answer

    Answer: C. Finds the shortest path in a weighted graph with non-negative edges

    Dijkstra's algorithm is used to find the shortest paths from a single source node to all other nodes in a graph with non-negative edge weights.

  5. Explain Amortized Analysis and give an example.

    Show answer

    Answer: C. Analyzing the average time complexity over a sequence of operations

    Amortized analysis considers the average time complexity of a sequence of operations, even if some individual operations are expensive.

Take the full quiz

More questions in this quiz

Answers and explanations are in the full quiz.

  1. What is the best-case time complexity of binary search?
  2. What is the space complexity of Merge Sort?
  3. What is the time complexity of finding the kth smallest element using QuickSelect?
  4. What is the time complexity of a naive string matching algorithm?
  5. Design an algorithm to find the longest palindromic substring within a given string and analyze its time complexity. Justify your choice of algorithm.

More quizzes

Browse all Programming quizzes

More to play

Daily ChallengeA new quiz every day. Keep your streak.HangmanGuess the word, letter by letter.Story QuestLearn through short interactive stories.All quizzesCBSE, ICSE, competitive exams and more.