Chapter 2 · Class 12 · CBSE · Science Computer Science
Alorithms
25 practice questions
Topics in this chapter
- Fundamentals and Properties of Algorithms
- Asymptotic Analysis and Time Complexity
- Searching Techniques (Linear and Binary Search)
- Sorting Algorithms (Bubble, Selection, Insertion, Merge)
- Array and String Processing Algorithms
- Mathematical and Number-Theoretic Algorithms
- Advanced Algorithm Design and Divide-and-Conquer
Cheat sheet
Cheat SheetPractice questions
- Question 1Q-203DC4See the answer and solution
Which condition is necessary before applying binary search to an array?
- A.The array must contain only integer values.
- B.The array must be sorted.
- C.The array must have an even number of elements.
- D.The array must not contain duplicate values.
- Question 2Q-1AA8E4See the answer and solution
Explain why binary search cannot generally be applied directly to an unsorted array. Also state the worst-case time complexity of linear search and binary search for an array of n elements.
- Question 3Q-D77CE7See the answer and solution
What is the array after the first complete pass of selection sort in ascending order on [29, 10, 14, 37, 13]?
- A.[10, 29, 14, 37, 13]
- B.[29, 10, 13, 37, 14]
- C.[10, 14, 13, 29, 37]
- D.[13, 10, 14, 37, 29]
- Question 4Q-E5BE84See the answer and solution
Which statement correctly describes the worst-case time complexity of insertion sort and the situation in which it performs efficiently?
- A.Its worst-case time complexity is O(log n), and it is efficient for randomly arranged data.
- B.Its worst-case time complexity is O(n), and it is efficient for reverse-sorted data.
- C.Its worst-case time complexity is O(n²), and it is efficient when the data is already or nearly sorted.
- D.Its worst-case time complexity is O(n²), and it is efficient only when all elements are identical.
- Question 5Q-5AFFB3See the answer and solution
Explain why merge sort is generally preferred over selection sort for sorting a large collection of data. State the time complexity of both algorithms in the average or worst case.
20 more questions on Alorithms
Sign up free to practise the full chapter. Questions you get wrong come back until you've mastered them.
Start practising freeFree to start · No credit card needed