Bird
Raised Fist0

Given a function that validates castling, what will be the output if the king is currently in check?

medium📝 Analysis Q4 of Q15
LLD - Design — Chess Game
Given a function that validates castling, what will be the output if the king is currently in check?
ACastling is allowed only on the king side
BCastling is not allowed
CCastling is allowed only on the queen side
DCastling is allowed
Step-by-Step Solution
Solution:
  1. Step 1: Recall castling restrictions related to check

    Castling is forbidden if the king is currently in check.
  2. Step 2: Apply this rule to the function output

    The function should return that castling is not allowed when king is in check.
  3. Final Answer:

    Castling is not allowed -> Option B
  4. Quick Check:

    King in check blocks castling = D [OK]
Quick Trick: King in check disables castling [OK]
Common Mistakes:
MISTAKES
  • Allowing castling while in check
  • Allowing castling only on one side incorrectly
  • Ignoring check status in validation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes