Intellect Design Arena interview question

Given an unsorted array, create a program in a language of your choice to get the maximum value and second highest value as well as the minimum value and second lowest value.