a
askaideAI
Log in
— CHAPTER MASTERY · CLASS 12

Searching Important Questions.

Master Searching with AI-powered practice. Our adaptive tutor identifies your gaps and provides step-by-step explanations for every topic in this chapter.

Exam-Ready Questions

Practice questions specifically designed for CBSE Class 12 Computer Science board exams. Covers all difficulty levels from basic to advanced.

Instant AI Doubts

Stuck on a tricky concept in Searching? Our AI tutor provides immediate, step-by-step explanations 24/7.

Adaptive Practice

The difficulty adjusts as you learn. Master foundations first, then move to challenging board-level problems.

Searching — Important Questions with Answers

Practice these Searching questions for Class 12 Computer Science, each with the correct answer and a step-by-step explanation. Sign up free to practice all 30+ questions with adaptive difficulty.

  1. Q1Easy

    What is the first step in the Binary Search algorithm for this sorted list: [2, 3, 5, 7, 10, 11, 12, 17, 19, 23, 29, 31, 37, 41, 43] when searching for key 2?

    • A.Set first to 0 and last to 15.
    • B.Calculate mid as 7 and compare it to the key.
    • C.Set both first and last to 0 and calculate mid as 0.
    • D.Check if the key is in the middle of the list by averaging the first and last indices.
    Answer: Calculate mid as 7 and compare it to the key.

    Explanation: In Binary Search, the algorithm begins by defining the search bounds using the first and last indices of the list. The mid index is calculated in the first iteration as (first + last) // 2. This step determines the midpoint to check for the key and narrows down the search interval.

  2. Q2Easy

    What happens if the hash function is not perfect in hashing?

    • A.The search time becomes linear.
    • B.Elements are stored in sorted order.
    • C.Collisions can occur, causing duplicates in a slot.
    • D.All keys are always found in constant time.
    Answer: Collisions can occur, causing duplicates in a slot.

    Explanation: A perfect hash function ensures that each key maps to a unique index in the hash table. If the hash function is imperfect, multiple keys can map to the same index, leading to collisions which require additional handling.

  3. Q3Easy

    Which of these lists is sorted in ascending order?

    • A.[3, 1, 5, 7, 11, 13, 19, 17]
    • B.[-2, 0, 13, 44, 8, 17, 19, 32]
    • C.[2, 4, 6, 8, 10, 12, 14, 16]
    • D.[1, 3, 5, 7, 11, 13, 17, 19]
    Answer: [1, 3, 5, 7, 11, 13, 17, 19]

    Explanation: Binary Search requires the list to be sorted in ascending order. In this list, each subsequent element is larger than the previous one, making it suitable for Binary Search.

  4. Q4Easy

    What does a time complexity of *O(log n)* indicate?

    • A.The algorithm's performance is linear with the input size.
    • B.The algorithm's performance doesn't improve with larger inputs.
    • C.The algorithm always takes the same amount of time regardless of input size.
    • D.The algorithm's performance improves logarithmically with input size.
    Answer: The algorithm's performance improves logarithmically with input size.

    Explanation: A time complexity of *O(log n)* means that the number of operations grows proportionally to the logarithm of the input size. This indicates that Binary Search remains efficient even as the list grows large.

  5. Q5Easy

    What is the output of the Python program that implements Linear Search on the list [1, -2, 32, 8, 17, 19, 42, 13, 0, 44] when searching for key 8?

    • A.Key not found.
    • B.Key found at position 4 (1-based index).
    • C.Key found at index 3 (0-based index).
    • D.Key found at the end of the list.
    Answer: Key found at index 3 (0-based index).

    Explanation: In Linear Search, the algorithm checks every element sequentially until it finds the key or reaches the end of the list. For the given list, the key 8 is located at index 3.

  6. Q6Easy

    What technique is used for collision resolution in Hashing if two keys map to the same slot?

    • A.Assign the keys to adjacent slots.
    • B.Recompute the hash functions.
    • C.Collision resolution mechanisms like chaining or open addressing.
    • D.Discard the key and continue without storing.
    Answer: Collision resolution mechanisms like chaining or open addressing.

    Explanation: When two keys map to the same index in a hash table, collision handling methods such as chaining or open addressing are used to store the second key elsewhere in the table.

  7. Q7Easy

    Which type of search algorithm does not require the list to be sorted?

    • A.Binary Search.
    • B.Hashing.
    • C.Linear Search.
    • D.Dijkstra's Algorithm.
    Answer: Linear Search.

    Explanation: Linear Search checks each element in sequence without any requirement for the list being sorted. This contrasts with Binary Search which needs the list to be sorted for efficiency.

  8. Q8Easy

    What is the primary advantage of Hashing over Linear Search?

    • A.It always requires a sorted list.
    • B.It takes *O(n)* time to perform a search.
    • C.Average *O(1)* time complexity for search operations.
    • D.Hashing is only effective for unsorted lists.
    Answer: Average *O(1)* time complexity for search operations.

    Explanation: Hashing uses hash functions to directly map keys to their respective positions in the hash table, providing an average search time complexity of *O(1)*, which is more efficient compared to Linear Search's *O(n)*.

  9. Q9Easy

    What do the applications of Binary Search include?

    • A.Simulating a coffee machine.
    • B.Sorting an unsorted list.
    • C.Searching a dictionary or telephone directory.
    • D.Compressing documents.
    Answer: Searching a dictionary or telephone directory.

    Explanation: Binary Search is commonly used in practical applications such as searching through dictionaries and telephone directories due to its efficiency in reducing the search space.

  10. Q10Easy

    How does a hash function assign keys to indices in the hash table?

    • A.By checking each list element sequentially.
    • B.By sorting the list first.
    • C.Using a mathematical function to determine the index.
    • D.Using binary search over the keys.
    Answer: Using a mathematical function to determine the index.

    Explanation: A hash function applies a mathematical operation (e.g., modulo) to a key to compute its index within the hash table, ensuring efficient access to keys.

  11. Q11Easy

    What does 'O(n)' indicate in the context of time complexity for algorithms?

    • A.The algorithm's runtime grows exponentially.
    • B.The algorithm's runtime remains constant regardless of input size.
    • C.The algorithm's runtime grows logarithmically with input size.
    • D.The algorithm's runtime grows linearly with input size.
    Answer: The algorithm's runtime grows linearly with input size.

    Explanation: The notation 'O(n)' refers to linear time complexity, indicating that the time taken by an algorithm grows proportionally with the size of the input.

  12. Q12Easy

    Which algorithm is best for searching in a sorted array?

    • A.Linear Search.
    • B.Hashing.
    • C.Selection Sort.
    • D.Binary Search.
    Answer: Binary Search.

    Explanation: Binary Search is optimized for sorted lists and repeatedly divides the search space in half, achieving efficient search with *O(log n)* complexity.

Practice all 30+ Searching questions — free

Start Free Practice

Why practice Searching on AskAide?

Preparing for board exams requires more than just reading Searching from the textbook. You need to apply concepts to different types of problems. AskAide's AI-powered platform makes this process seamless for Class 12 students.

Our question bank for Searching is generated from the NCERT chapter text itself, so every question stays inside the syllabus. Whether it's complex numericals or conceptual theory, our AI tutor helps you break down every problem.

  • Unlimited practice questions for Searching
  • Personalized feedback on your weak areas
  • NCERT-aligned curriculum for Computer Science
  • Free access for students across India

Ready to ace your exams?

Students across India are already practising their chapters on AskAide — free during early access.

Try for free now
Menu