More problems to help you prepare for Exam II

I. True/False 1. A variable declared inside the main function of an application may be used in any other function declared in the same class. 2. Given: int x=7; int y=10; The result of the boolean expression: (x==7 || y>10) is true. 3. Given: int array[]={2,4,6,8}; The for loop to print the values of this array to the screen is: for(int index=0;index<8;index++) System.out.println(array[index]); 4. The purpose of try and catch blocks is to handle exceptions. 5. An error that occurs when you try to compile your program is called a runtime error. II. Function Calls and Arguments 1. Given these declarations and function calls: double miles=400, gallons=10; calcMPG(miles, gallons); What would the first line of this function look like? 2. Given this function call: int result=calcTemperature(); What would you expect the first line of this function to look like? 3. Given this function definition: public static void Greeting() { System.out.println("Hello World"); } How would you call this function?