Exam 7: User-Defined Methods

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

The class Math is contained in the package java.math.

(True/False)
4.9/5
(49)

public static char methodHeading(int n, double num)Based on the method heading in the accompanying figure, what is the return type of the value returned?

(Multiple Choice)
5.0/5
(45)

Formal parameters of primitive data types provide ____ between actual parameters and formal parameters.

(Multiple Choice)
4.7/5
(34)

int larger(int x, int y)Given the method heading in the accompanying figure, which of the following does NOT demonstrate method overloading?

(Multiple Choice)
4.9/5
(36)

public static double secret(int first, double second) { Double temp; if (second > first) Temp = first * second; Else Temp = first - second; return temp; }What is the name of the method in the accompanying figure?

(Multiple Choice)
4.8/5
(38)

The return statement must be the last line of the method.

(True/False)
4.8/5
(44)

public int mystery(int x, int y) { If (x >= y) Return x - y; Else Return x + y; }Based on the code in the accompanying figure, what would be the output of the following statement?System.out.println(mystery(8, mystery(2, 1));

(Multiple Choice)
4.8/5
(42)

public class scopeRule //Line 1 { //Line 2 Static double intRate = 0.055; //Line 3 Static String name; //Line 4 Static int t; //Line 5 public static int main(String[] args) //Line 6 { //Line 7 Int first; //Line 8 Double u, t; //Line 9 String str; //Line 10 //... //Line 11 } //Line 12 public static int first(int x, int y) //Line 13 { //Line 14 Int t; //Line 15 //... //Line 16 } public static double salary; //Line 17 public static void funcOne(int first, double x) //Line 18 { //Line 19 Char ch; //Line 20 Int y; //Line 21 //block one //Line 22 { //Line 23 Int u = 18; //Line 24 //... //Line 25 } //end block one //Line 26 } //Line 27 } //Line 28Which of the following is an example of a local identifier in the example seen in the accompanying figure?

(Multiple Choice)
4.9/5
(31)

int larger(int x, int y)Given the method heading in the accompanying figure, which of the following would be an incorrect demonstration of method overloading?

(Multiple Choice)
4.9/5
(41)

You can use the class String to pass strings as parameters to a method and change the actual parameter.

(True/False)
4.9/5
(37)

Which modifier is used to specify that a method cannot be used outside a class?

(Multiple Choice)
4.8/5
(42)

Which of the following statements is NOT true?

(Multiple Choice)
4.8/5
(46)

In Java, return is a reserved word.

(True/False)
4.9/5
(35)

public static double secret(int first, double second) { Double temp; if (second > first) Temp = first * second; Else Temp = first - second; return temp; }Based on the code in the accompanying figure, what would be the output of the following statement?System.out.println(secret(5, 7.0));

(Multiple Choice)
4.9/5
(39)

All the methods defined in a class must have different names.

(True/False)
4.9/5
(35)

Methods are also called modules.

(True/False)
4.9/5
(34)

Two methods are said to have different formal parameter lists if both methods have a different number of formal parameters, or if the data types of the formal parameters are the same.

(True/False)
4.8/5
(37)

public class scopeRule //Line 1 { //Line 2 Static double intRate = 0.055; //Line 3 Static String name; //Line 4 Static int t; //Line 5 public static int main(String[] args) //Line 6 { //Line 7 Int first; //Line 8 Double u, t; //Line 9 String str; //Line 10 //... //Line 11 } //Line 12 public static int first(int x, int y) //Line 13 { //Line 14 Int t; //Line 15 //... //Line 16 } public static double salary; //Line 17 public static void funcOne(int first, double x) //Line 18 { //Line 19 Char ch; //Line 20 Int y; //Line 21 //block one //Line 22 { //Line 23 Int u = 18; //Line 24 //... //Line 25 } //end block one //Line 26 } //Line 27 } //Line 28Which of the following identifiers seen in the accompanying figure is visible in block one?

(Multiple Choice)
4.7/5
(26)

The program that tests a method is called a ____ program.

(Multiple Choice)
4.9/5
(40)

Reference variables as parameters allow you to return more than one value from a method.

(True/False)
4.8/5
(28)
Showing 21 - 40 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)