Bird
0
0

If the keyword 'apple' maps to [1, 3, 5] and 'banana' maps to [2, 3], what is the result of searching for documents containing both 'apple' and 'banana'?

medium📝 Analysis Q13 of 15
LLD - Design — Library Management System
Consider a search system where the index maps keywords to document IDs. If the keyword 'apple' maps to [1, 3, 5] and 'banana' maps to [2, 3], what is the result of searching for documents containing both 'apple' and 'banana'?
A[1, 2, 3, 5]
B[3]
C[1, 5]
D[2, 3, 5]
Step-by-Step Solution
Solution:
  1. Step 1: Identify documents for each keyword

    'apple' maps to documents [1, 3, 5], 'banana' maps to [2, 3].
  2. Step 2: Find intersection of document lists

    Documents containing both keywords are in both lists. Intersection of [1, 3, 5] and [2, 3] is [3].
  3. Final Answer:

    [3] -> Option B
  4. Quick Check:

    Intersection = [3] [OK]
Quick Trick: Search AND means intersection of document lists [OK]
Common Mistakes:
MISTAKES
  • Merging lists instead of intersecting
  • Confusing union with intersection
  • Ignoring common documents

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes