Bird
0
0

A search filter system is returning incorrect results when filtering by date range. Which of the following is the most likely cause?

medium📝 Analysis Q14 of 15
LLD - Design — Hotel Booking System
A search filter system is returning incorrect results when filtering by date range. Which of the following is the most likely cause?
ADate values are stored as strings and compared lexicographically
BThe filter uses numeric comparison on date objects
CThe database index is on the wrong column
DThe search query is missing a filter parameter
Step-by-Step Solution
Solution:
  1. Step 1: Understand date comparison issues

    Comparing dates stored as strings can cause wrong order because string comparison is lexicographic.
  2. Step 2: Identify why this causes incorrect results

    Dates like '12/01/2023' and '02/12/2023' compared as strings may not sort correctly, causing wrong filter results.
  3. Final Answer:

    Date values are stored as strings and compared lexicographically -> Option A
  4. Quick Check:

    String date comparison causes errors = A [OK]
Quick Trick: Store dates as date objects, not strings [OK]
Common Mistakes:
  • Assuming numeric comparison works on strings
  • Ignoring index relevance
  • Thinking missing filter param causes wrong filtered results

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes