Cordis Technology interview question

Asked some programming questions and some puzzles