QUESTION 15 Here is a method signature: method1 ( int a, float b) Which of the f
ID: 3861001 • Letter: Q
Question
QUESTION 15 Here is a method signature: method1 ( int a, float b) Which of the following methods correctly overloads method1? a. method2 ( int a, float b ) O b method2 (float a, int b) c. method 1 (float a, int b ) O d. method1 (int b, float a ) QUESTION 16 The parameter list in the method header and the arguments in the method call must agree in: O a. number b. type c. order O d, all of the above QUESTION 17 public static void getStudentinfo(String userlD, double gpa) Based on the above method header, the method is O a, value-receiving O b.invalid Oc. parameterless
Explanation / Answer
Q15) C
Over loading means, two methods have same method name but differ in signature.
Given method is method1 and parameters are int and float respectively
So option should be with the same name, that is method1 and it’s parameters should not be equal to int, float.
The correct method is method1(float a, int b)
Q16) D
The number of parameters should be equal
Same data types
Same order should be follow.
Q17) A
The method have parameter of string and gpa. That means it’s take student’s userid and gpa as parameter. So the method will receive values of the student.
Q18) D
The output of segment A is:
5
default
The output of segment B is:
4
5
default
So, the correct option is D
Note: option C is not correct, due to there is not new line between 4, 5 and default.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.