2. (12 points; 2 points each part) For each method call in the table below, dete
ID: 3722170 • Letter: 2
Question
2. (12 points; 2 points each part) For each method call in the table below, determine which of the methods on the top table is actually.called, or indicate that it is impossible because there is either no method that matches, there are several methods that match, or something else has gone wrong. Method Method Signature ldentifier int exponent int first, int second) double exponent (int first, int second) double exponent (int first, double second) double exponent (double first, int second) double exponent (double first, double second) Method Call double power- exponent (3, 5.2); double power-exponent(1, 5, 7); nt power exponent (4.2, 3.8); double power- exponent (4.2, 3.8); int power- exponent (3, 5); double power exponent (1.3, 2.4, 3.6, 4.8); Method ldentifier (a to f) or ImpossibleExplanation / Answer
Answer:
Method Call Method Identifier(a to f)or Impossible double power = exponent(3,5.2) Answer is C. It calls this function because the arguments are int and double and so the values double power = exponent(1,5,7) Answer is F. It has 3 double arguments and integers can be allowed as a double value int power = exponent(4.2 , 3.8) Impossible. Function return type is double so the program wont allow to call any of the functionmentioned double power = exponent(4.2 , 3.8) Answer is E. It has two double arguments and it will be called . int power = exponent(3,5) Answer is A. The arguments are both integers in fuction definition and calling. double power = exponent(1.3, 2.4, 3.6, 4.8) Impossible. There is no method with 4 arguments in the mentioned.Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.