Option D is correct.
Take an example :
Initially TOP = 0 and i = 0.
we perform PUSH(S, 10), PUSH(S, 20), PUSH(S, 30), PUSH(S, 40), PUSH(S, 50),
now TOP = 5 and i = 1 to 5.
[N = Number of Elements in Stack]
Case I : TOP - i < N
5 - 5 < N
0 < 5. ie. giving underflow but its not underflow because at i = 5 we have 10 present. [ A is Incorrect]
Case II : TOP - i + 1 < N
5 - 5 + 1 < N
1 < 5. ie. giving underflow but its not underflow because at i = 5 we have 10 present. [ B is Incorrect]
Case III : TOP - i <= 0
5 - 5 <= 0
0 <= 0. ie. giving underflow but its not underflow because at i = 5 we have 10 present. [ C is Incorrect]
Case IV : TOP - i + 1 <= 0
5 - 5 + 1 <= 0
1 <= 0. ie. NO underflow
5 - 6 + 1 <=0
0 <= 0. Correct underflow. Hence, D is correct answer.