Short answerEasy2 marks
Write the java expression to find the product of square root of P and the square root of Q using the methods of Math class.
Topic: Math class expressions
Previous-year question practice database
Answer
Exam answer
Math.sqrt(P) * Math.sqrt(Q)
Explanation
Math.sqrt() takes one argument and returns its square root as a double, so each root must be written as its own call and the two results multiplied with *. A neat alternative that also earns full marks is Math.sqrt(P * Q), since the square root of a product equals the product of the square roots. What loses marks is writing Math.sqrt(P, Q) — the method never takes two arguments.
More from Library Classes
What is the output of the statement Math.pow(36, 6/5);?2026The output of the statement:
System.out.println(Character.toUpperCase('b') + 2); is:2026What is the type of parameter to be given for the method parseInt()?2026Write the Java expression to find the sum of cube root of x and the absolute value of y.2026Character class methods are found in the package called:2025The output of Math.max(-7, Math.min(-5, -4)) is2025