Question:

What is the output of the statement Math.pow(36, 6/5) ?

Show Hint

In Java, integer division is very important. When both operands are integers, the decimal part is removed. So \(6/5\) becomes \(1\), not \(1.2\).
  • 36.0
  • 1.0
  • 73.71
  • 6.0
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

Step 1: Understand the function Math.pow(a,b).
The function Math.pow(a,b) returns the value of \(a^b\), that is, the first argument raised to the power of the second argument.
Here, the statement is: \[ Math.pow(36, 6/5) \] Step 2: Evaluate the expression \(6/5\).
In Java, when both numbers are integers, integer division is performed. Since \(6\) and \(5\) are both integers: \[ 6/5 = 1 \] The fractional part is discarded. So the statement becomes: \[ Math.pow(36, 1) \] Step 3: Calculate the power.
Now, \[ 36^1 = 36 \] Since Math.pow() returns a double value, the output will be: \[ 36.0 \] Step 4: Note about the given options.
By Java rules, the mathematically correct output of Math.pow(36, 6/5) is 36.0.
So:
  • (A) 36.0 is the correct output.
  • (D) 6.0 would be incorrect for this exact Java statement.
Final Answer:\(36.0\).
Was this answer helpful?
0
0

Questions Asked in ICSE Class X board exam

View More Questions