Ocrolus interview question

Logic questions on HOC JavaScript function.