IBM interview question

Simple coding questions from hackerrank.