Tata interview question

basic qtns