Quiz Question C & C++ Array & FIle read or write


1. What will be the output of following code? 

int arr[5]={22,2,78,12,4};
for(int i=0;i<5;i++)
{
 for(int j=0;j<i;j++)
 {
   if(arr[i]>arr[j])
    {
      int temp;
      temp= arr[i];            
      arr[i]=arr[j] ;            
      arr[j]=temp;           
    }
 }
}
for(int i=0;i<5;i++)
    cout<<arr[i]<<" ";





2. Write a program that reads marks of 100 students from the file specified by user (Read Input filename from user), and print highest and lowest marks in the second file specified by user (Read Output filename from user).