| preferred AP College board partner for AP classes
AP Computer Science A/Unit 1: Primitive Types
Start Practice TestPractice Test
About Exam
hard Solved by 5 students
Java Math Class Methods
< Prev
Next >

Consider the following incomplete method mathOperations.

public static double mathOperations(double x, double y, double z) {
    /* missing statement */
    return result;
}

The method is intended to work as shown in these examples:

  • A call to mathOperations(25, 3, -10) should return 55.0.
  • A call to mathOperations(36, 2, -5) should return 29.0.

Which of the following statements can replace /* missing statement */ so that the method works as intended?

A

double result = Math.sqrt(x) + Math.pow(y, 2) + Math.abs(z);

B

double result = Math.pow(x, y) - Math.abs(z);

C

double result = Math.sqrt(x) * Math.pow(y, 2) + Math.abs(z);

D

double result = x + y - z * Math.abs(y);

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1demosolasis111 0m 52s 48
#2theofanusmischa11 1m 07s 33
#3keithy.mcbeefy11 1m 31s 9
#410818526502 0m 00s -20
#5thamminenigamya11 3m 45s -125
Items per page:
10
1 – 5 of 5
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy