Advertisement Upgrade to remove ads

In a @return tag statement the description
A. Describes the return value
B. Must be longer than one line
C. Cannot be longer than one line
D. Describes the parameter values

Describes the return value

Which of the following is not part of a method call?
A. Return type
B. Parentheses
C. Method name
D. All of the above are part of a method call

Return type

This type of method method performs a task and sends a value back to the code that called it.
A. Local
B. Void
C. Complex
D. Value-returning

Value-returning

When an object, such as a String, is passed as an argument, it is
A. Passed by value like any other parameter value
B. Actually a reference to the object that is passed
C. Encrypted
D. Necessary to know exactly how long the string is when writing the program

Actually a reference to the object that is passed

The header of a value-returning method must specify this.
A. The method's local variable name
B. The data type of the return value
C. The name of the variable in the calling program that will receive the returned value
D. All of the above

The data type of the return value

public static int minimum(int x, int y)
{
int smaller;

if (x < y)
smaller = x;
else
smaller = y;

return smaller;
}


Which of the following is a valid call to the method above?
1. minimum(int x, int y);
2. minimum(int 5, int 4);
3. minimum(5, 4);
4. public static int minimum(5, 4);

minimum(5, 4);

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; //Line 25

//block three
{
int x = 12; //Line 29
//...
}//end block three
// block two... //Line 32
}
}


Where is identifier x (block three's local variable) visible?
1. In two and block three
2. In block three and main
3. In block three only
4. In one and block three

In block three only

public static String exampleMethod(int n, char ch)


Based on the method heading above, what is the return type of the value returned?
1. char
2. String
3. int
4. Nothing will be returned

String

public static int minimum(int x, int y)
{
int smaller;

if (x < y)
smaller = x;
else
smaller = y;

return smaller;
}


Based on the above code, what would be the output of the statement

int s = minimum(5, minimum(3, 7));
1. 5
2. There would be no output; this is not a valid statement.
3. 7
4. 3

3

Please allow access to your computer’s microphone to use Voice Recording.

Having trouble? Click here for help.

We can’t access your microphone!

Click the icon above to update your browser permissions above and try again

Example:

Reload the page to try again!

Reload

Press Cmd-0 to reset your zoom

Press Ctrl-0 to reset your zoom

It looks like your browser might be zoomed in or out. Your browser needs to be zoomed to a normal size to record audio.

Please upgrade Flash or install Chrome
to use Voice Recording.

For more help, see our troubleshooting page.

Your microphone is muted

For help fixing this issue, see this FAQ.

Star this term

You can study starred terms together

NEW! Voice Recording

Create Set