Jain Software Interview Question

Logical question