ITPEC FE Morning April 2020 Question 7
ITPEC FE Morning April 2020 — Question 7 of 80
Leap Year Counting — count leap years in a range using divisibility rules.
Rules for leap year:
- Divisible by 4 → leap year
- Except divisible by 100 → not a leap year
- Except divisible by 400 → leap year
Range: 1895–2021 → first leap year 1896, last 2020
Step 1: Count years divisible by 4:
- (2020 - 1896) / 4 + 1 = 32
Step 2: Subtract centurial years (divisible by 100):
- 1900, 2000 → subtract 2
Step 3: Add back years divisible by 400:
- 2000 → add 1
Result: 32 - 2 + 1 = 31
Why not others:
- (a) 30 — forgot to add back 2000 (divisible by 400)
- (c) 32 — forgot to exclude 1900 (centurial, not divisible by 400)
- (d) 33 — miscounted the range boundaries
Key rule: Leap year = divisible by 4, except centuries, except centuries divisible by 400.
AI-generated — may contain errors
The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.