CS 172 Pratice Problems 1.) What is the output of the segment below and how many times does the loop get executed? int arr[10], i = 0; while (i < 4) { i = i + 1; arr[i] = i * i; cout << arr[i] << endl;} 2.) Show the output from the printf: int j = 0; int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8 }; while (j < 9) { if (j > 4) { cout << a[j] << endl; ++j; } else ++j; } 3.) How many times does the following loop segment get executed and show the output each time: int n, m; n = 15; m = 20; while (n < m) { ++n; m = m - 1; cout << n << " " << m << endl; } 4.) An integer array is initialized with the following exam grades: 88, 92, 77, 80. Write a program that contains this array, sums the array elements (grades), and calculates the average. Print the sum and average 5.) Given the following initializing of the array word: char word[] = {'E','X','A','M'} Write a program to print the word EXAM. 6.) Bubble sort: Given the following list of six numbers use the bubble sort algorithm (by hand) to sort the list in ascending order: -40 89 17 -65 2 55