Bird
0
0

A move validation function always returns false, rejecting all moves. Which change is most likely to fix this issue?

medium📝 Analysis Q7 of 15
LLD - Design — Tic-Tac-Toe Game
A move validation function always returns false, rejecting all moves. Which change is most likely to fix this issue?
AAdd more logging to the function without changing logic
BAdjust boundary checks to use inclusive comparison operators correctly
CIncrease the timeout for move validation requests
DRemove all condition checks to allow all moves
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the symptom

    All moves rejected suggests boundary conditions are too strict or incorrect.
  2. Step 2: Identify common bug

    Using exclusive operators (e.g., < or >) instead of inclusive (e.g., <= or >=) can cause valid moves to be rejected.
  3. Step 3: Apply fix

    Correct the comparison operators to properly include valid boundary values.
  4. Final Answer:

    Adjust boundary checks to use inclusive comparison operators correctly -> Option B
  5. Quick Check:

    Incorrect boundary checks cause false negatives [OK]
Quick Trick: Check boundary conditions for inclusive comparisons [OK]
Common Mistakes:
MISTAKES
  • Ignoring boundary condition logic
  • Removing validation entirely
  • Changing unrelated parameters like timeout

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes