question archive What is method overloading? Group of answer choices Creating multiple versions of methods with the same name, but different numbers or types of parameters
Subject:Computer SciencePrice:8.89 Bought3
What is method overloading?
Group of answer choices
Creating multiple versions of methods with the same name, but different numbers or types of parameters.
Creating a method that has more than one return value.
Putting too many parameters in a method.
Creating a method that has more code than will fit.
If you have the following two methods in a class, will the code compile?
public int getMileage(int miles, int gallon) {...}
public int getMileage(int kilometers, int liters) {...}
Group of answer choices
No
Yes
There is no way to tell
If you have the following two methods in a class, will the code compile?
public int getMileage(int miles, int gallon)
public int getMileage(int kilometers, double liters)
Group of answer choices
No
Yes
There is no way to tell
If you have the following two methods in a class, will the code compile?
public int getMileage(int miles, int gallon)
public double getMileage(int kilometers, int liters)
Group of answer choices
There is no way to tell
No
Yes
Will the following code compile correctly?
for (int i = 0; i <= 20; i++) {
// code
}
System.out.println("The value of i is:" + i);
Group of answer choices
Yes
I don't know
No
Assuming the following declaration, how do you access the last element of the array?
double[] temps = {79.2, 38.5, 37.6, 41.5, 96.3, 70.0};
Group of answer choices
temps[temps.length-1]
temps(6)
Temps[length-1]
temps(temps.length-1)
temps[6]
Will the following code compile?
public class Teacher {
public void addTeacherName(String name) {
String teacher_name = name;
}
public String getName() {
return teacher_name;
}
} // end class
Group of answer choices
Yes, and it will run
Yes, but will not run
No
Which of the following example shows the correct use of runtime arguments (also known as command line parameters) in the Dr.Java interactions pane?
Group of answer choices
run avgNumbers 12, 19, 27
run avgNumbers(12, 19, 27)
avgNumbers(12, 19, 27);
run avgNumbers 12 19 27
avgNumbers 12 19 27
What code below would work to check a method pre-condition that the integer parameter passed in (assume it is called distance) must be either 0 or a positive value?
Group of answer choices
if (distance < 0) { <print error message and return> } else { <do method stuff> }
if (distance >= 0) { <print error message and return> } else { <do method stuff> }
if (distance <= 0) { <print error message and return> } else { <do method stuff> }
if (distance > 0) { <print error message and return> } else { <do method stuff> }
What is the sum of the following two binary numbers:
0 1 0 0 1 1 1 0
+ 1 1 0 0 0 0 0 1
Group of answer choices
0 0 0 1 -1 1 0 1
1 2 0 0 -1 1 1 1
1 -0 1 0 0- 0 1 1 1
1 -0 0 0 0- 1 1 1 1
Subtract the following binary numbers:
1 1 0 1
- 0 0 1 0
Group of answer choices
1011
0 0 1 0
1101
0100
Convert the following hexadecimal value to binary:
F17EB2
Group of answer choices
1111-0001-0111-1110-1011-0010
1111-0001-1011-1110-1011-0010
1111-0001-0111-0110-1011-0010
1111-0001-0111-1101-1011-0010
Convert the following hexadecimal value to octal:
17E2
Group of answer choices
03816
21074
13742
76301
If you have the following two methods in a class, will the code compile?
public int getMileage(int miles, int gallon)
public int getMileage(int kilometers, int liters, boolean diesel)
Group of answer choices
There is no way to tell
Yes
No
Purchased 3 times