KBC interview question

in tray exercise