Question: 1. To use a predefined method you must know the code in the body of the method. a) TRUE b)FALSE 2. The value returned by
1. To use a predefined method you must know the code in the body of the method.
a) TRUE
b)FALSE
2. The value returned by a value-returning method can be saved for further calculation in the program.
True
False
3.
A formal parameter is a variable declared in the method heading (ie. it's signature).
True
False
4.
A local identifier is an identifier that is declared within a method or block and that is visible only within that method or block.
True
False
5.
No two methods in the same class can have the same name.
True
False
6.
Void methods have no return type.
True
False
7.
The return statement must be the last line of the method.
True
False
8.
When a program executes, the first statement to execute is always the first statement in the main method.
True
False
9.
Given the method heading
public static String exampleMethod(int n, char ch)
what is the return type of the value returned?
| int | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| char | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| String | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Nothing will be returned 10. The method toString() is used to convert an object to a String object. True False 11. Consider the following method. 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 java statement which calls this method?
12. Consider the following method. public static int minimum(int x, int y) { int smaller; if (x < y) smaller = x; else smaller = y; return smaller; } What is the value of s after the following statement executes? int s = minimum(5, minimum(3, 7));
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
