Cerium Systems Interview Question

Gave one scenario and asked to write a code.