Question 11
public class ScopeRules // line 1
{
static final double rate=10.50;
static int z;
static double t;
public static void main(String[]args) // line 7
{
int num;
double x, z;
char ch;
// main block...
}
public static void one(int f, char g) // line 15
{
// block one...
}
public static int w; // line 20
public static void two(int one,int i) // line 22
{
char ch;
int a;
//block three
{
int x = 12; // line 29
//...
}//end block three
// block two... // line 32
}
}
Which of the following identifiers is NOT visible in block three?
a. z (before main)
b. t (before main)
c. main
d. local variables of method two


Question 12
public static int minimum(int x, int y)
{
int smaller;
if(x<y)
smaller = x;
else
smaller = y;
return smaller;
}
What is the return type of the method above?
a. public
b. int
c. void
d. Nothing is returned.
Question 13
int larger(int x, int y)
Given the method heading above, which of the following would be an incorrect demonstration of method overloading?
a. int larger(int a, int b)
b. int larger(int x, int y, int z)
c. double larger(double x, double y)
d. char larger(char x, char y, char z)
Question 14
Which of the following is NOT true about return statements?
a. A value-returning method returns its value via the return statement.
b. Return statements cannot be used in void methods.
c. A method can have more than one return statement.
d. Whenever a return statement executes in a method, the remaining statements are skipped and the method exits.
Question 15
The expression (int)9.9 evaluates to ____.
a. 9
b. 10
c 9.9
d. 9.0
Question 16
Which of the following is the correct syntax for commenting in Java?
a. # Enter Comments Here
b.
c. /* Enter Comments Here*/
d. ** Enter Comments Here **
Question 17 All of the following are examples of integral data types EXCEPT ____.
a. int
b. char
c. double
d. byte
Question 18
____ are executable statements that inform the user what to do.
a. Variables
b. Prompt lines
c. Named constants
d. Expressions
Question 19
The memory allocated for a float value is _____.
a. 2 bytes
b. 4 bytes
c. 8 bytes
d. 32 bytes
Question 20
The value of 3 % 9 is ___.
a. 0
b. 9
c. 1/3
d. 3