MCQHard1 mark
1
Choose the correct answers to the questions from the given options. (Do not copy the questions, write only the correct answers.)
What is the output of the statement Math.pow(36, 6/5);?
Topic: Math.pow() and integer division
Previous-year question practice database
Try it
Pick an option and check your answer. The full worked answer is below either way.
Answer
Exam answer
(a) 36.0.
Explanation
The trap is inside the second argument. 6/5 is division of two ints, so Java performs integer division and the result is 1, not 1.2. The call becomes Math.pow(36, 1), which is 36 — and since Math.pow() always returns a double, it prints 36.0. Had the question written 6.0/5 the answer would have been about 73.71, which is why option (c) is offered.
In words
36.0.
More from Library Classes
The 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)) is2025Which of the following converts "25" to 25.0?2025