Option (B) is correct.
Explanation: Student d toggles locker k exactly when d is a factor of k. So a locker is toggled as many times as it has factors. A locker that starts closed ends up open only if it is toggled an odd number of times.
Factors come in partner factors: if d is a factor of k, so is k÷d. For example, the factors of 12 pair up as (1, 12), (2, 6), (3, 4): six factors, an even number. The count is odd only when some factor is its own partner, that is, when k=d×d. So only the perfect squares have an odd number of factors.
For example, 36 has the factors 1, 2, 3, 4, 6, 9, 12, 18, 36. Here 6 is its own partner, so there are 9 factors and locker 36 is open.
The perfect squares from 1 to 50 are 1, 4, 9, 16, 25, 36, 49. So 7 lockers are open.
Why the other options are wrong
- (A) 25 assumes half the lockers stay open. Whether a locker is open depends on how many factors its number has, not on half of 50.
- (C) 15 is the number of primes up to 50. A prime has exactly two factors, so those lockers are toggled twice and end up closed.
- (D) 10 is the answer for 100 lockers (12 to 102). Here 64, 81 and 100 are more than 50, so they do not count.