Bird
0
0

Which of the following is a correct basic check in move validation logic?

easy🧠 Conceptual Q12 of 15
LLD - Design — Tic-Tac-Toe Game
Which of the following is a correct basic check in move validation logic?
Aif move.position = max_position: return True
Bif move.position == 'any': return True
Cif move.position < 0 or move.position > max_position: return False
Dif move.position > max_position then return False
Step-by-Step Solution
Solution:
  1. Step 1: Check syntax correctness

    if move.position < 0 or move.position > max_position: return False uses proper comparison operators and syntax for boundary check.
  2. Step 2: Identify errors in other options

    if move.position == 'any': return True uses string instead of number, C uses assignment (=) instead of comparison (==), D uses invalid syntax 'then'.
  3. Final Answer:

    if move.position < 0 or move.position > max_position: return False -> Option C
  4. Quick Check:

    Boundary check uses < and > with proper syntax [OK]
Quick Trick: Use proper comparison operators and syntax for validation checks [OK]
Common Mistakes:
MISTAKES
  • Using assignment '=' instead of comparison '=='
  • Using invalid keywords like 'then'
  • Checking position against wrong data types

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes