Persistent Systems Interview Question

Apply exception for the written code(In technical 2)