Accenture interview question

Asked to write code and explain the concepts