Infosys Interview Question

logical question