Ms Gold AP Java Term 1 Progress Report Study Guide: Name ______________________________________________________________ 1) String[] names; names = new String[ 10 ]; names[ 0 ] = "Beavis"; names[ 1 ] = "Buthead"; names[ 2 ] = "Homer"; int i = 5-3; System.out.println( names[ i ] ); What is the output of the print statement? 2) What is an index? What are the bounds of an array? What is a bounds error? 3) myArray[5] = 6 What is the value of the index? what is the value stored in the array and the specified index? 4) Explain what an Array is. 5) Declare an array that holds 10 int's. 6) What is the public static void main(String[] args) method used for? 7) Even though each main is static why is it recommended to have a main in each class you write. 8) What is the value of r[ 0 ] after the following code has been executed? Explain. int[] r = { 1, 2, 3, 4 }; r[ 0 ] = r[ 1 ]; r[ 0 ]++; 9) Look carefully at this code and tell me if it will work? Explain why it does or does not work; for ( int i = 0 ; i == 10 ; i++ ) System.out.println( i ); 10) Complete the code so it calculates and prints out the sum of the array int[] a = { 6, 2, 3, 4, 9, 1 }; int sum = 0; for ( ; ; ) { } 11) How many iterations does the following loops carry out. for (int i=0; i < 10; i++) { } System.out.println("i= " + i); 12) Which of the following statements are true or false a) All elements of an array are of the same type b) An array index must be an integer c) Arrays cannot contain string references as elements. c) Arrays cannot contain null references as elements.- d) two-dimnsionl arrays always have the same number of rows and coulumns. e) elements of different columns in a two dimensional array can have different types. 13) populate an array of size 10 with 10 Random numbers. 14) Write two constructors for a class MyConstructorTester; Constructor one is an no argument constructor that sets the instance variable numOfConstuctor = 2; Constructor two takes in a parameter/argument(int num) and set the numOfConstructors = num. pulic class MyConstructor { private int numOfConstructrs; } 15) What is an Assessor method? 16) What is a Mutator method? 17) Why does a mutator method never return a value? 18) What doe API stand for? 19) Write an HelloWorld program. 20) Why do all class names start with a capital letter even though the compiler will except the name as legal?