# Code Practice with Arrays¶

Fix the `Test1` program to print the values in the array `a1` starting with the value at the last index and then backwards to the value at the first index.

Rewrite the `Test2` program so that it prints all the values in an array `arr1` using a for-each loop instead of a `for` loop.

Finish the `Test3` program so that it prints out all of the odd values in the array `a1`.

Finish the `Test4` program to print the strings at the odd indices in the array.

In the `Test5` program, replace the “ADD CODE HERE” with the code to declare and initialize a two-dimensional String array called `students` with the names “Brice, Marvin, Anna” in the first row and “Kamal, Maria, Elissa” in the second. The finished code will print all the names in the array starting with all in the first row followed by all in the second row.

In the `Test6` program, print the values 47, 51, and 20 by accessing them in the the given two-dimensional array.

In the `Test7` program, print the values 8, 3, 87, and 34 by accessing them from the given two-dimensional array.

In the `Test8` program, print the number of rows in the given two-dimensional array, or the length of the outer array. Then print the number of columns, or the length of each inner array.

Ex. The array { {“hello”,”there”,”world”},{“how”,”are”,”you”} } should print:

Rows: 2

Columns: 3

In the `Test9` program, loop through the given two-dimensional array, printing out the values in the first row followed by those in the second row and so on.

In the `Test10` program, declare and create a two-dimensional array of strings named `colors`. Put the colors (“red”, “yellow”, “blue”) in the first row, and the colors (“orange”, “green”, “purple”) in the second row. Then print every value in the array.

Replace the “ADD CODE HERE” in the `Test11` program with the code to count and print the number of 7’s that are in the 2d array. It should print 2.

Replace the “ADD CODE HERE” in the `Test12` program with the code to print out the sum of the numbers in the second row of the “table” array. It should print 18.

Replace the “ADD CODE HERE” in the `Test13` program with the code to find the sum of the values on the diagonal from  to [num rows - 1][num rows - 1] Print the sum. It should print 5.

Replace the “ADD CODE HERE” in the `Test14` program with the code to declare and create a two-dimensional array of integers `numbers` with the numbers (1,2,3) in the first row, and the numbers (4,5,6) in the second row. Then loop through the two-dimensional array, printing out the values in the first row followed by those in the second row.

Replace the “ADD CODE HERE” in the `Test15` program with the code to declare and create a two-dimensional array of integers `numbers` with the numbers (1,2,3) in the first row, the numbers (4,5,6) in the second row, and the numbers (7,8,9) in the third row. Then loop through the two-dimensional array, printing out the values in the first row followed by those in the second row and so on.

In the `Test16` program, replace the “ADD CODE HERE” below with the code to replace the word “purple” with “yellow”.