- A23.0
- B1112.0
- C32.0
- D24.0
Time Taken:
Correct Answer:
Wrong Answer:
Percentage: %
Let's analyze the given expression and the output of the Java Math functions:
Math.pow(36, 0.5) + Math.cbrt(125) + Math.ceil(4.2) + Math.floor(7.9)
The Math.pow(x, y) method returns x raised to the power of y.Math.pow(36, 0.5) calculates the square root of 36.√36 = 6.0
The Math.cbrt(x) method returns the cube root of x.Math.cbrt(125) calculates the cube root of 125.∛125 = 5.0
The Math.ceil(x) method returns the smallest integer greater than or equal to x.Math.ceil(4.2) returns the smallest integer greater than or equal to 4.2.Math.ceil(4.2) = 5.0
The Math.floor(x) method returns the largest integer less than or equal to x.Math.floor(7.9) returns the largest integer less than or equal to 7.9.Math.floor(7.9) = 7.0
Adding these values together:6.0 + 5.0 + 5.0 + 7.0 = 23.0
The output of the expression is: 23.0
The parseLong() function is a member of the Long wrapper class.
parseLong() is a static method provided by the Long wrapper class in Java.String into a long value.a) Long wrapper class
Positive
Explanation:
In Call by Value, the values of the actual parameters are copied to the formal parameters. Any changes made to the formal parameters do not affect the actual parameters.
Explanation:
parseInt() is a static method of the Integer wrapper class in Java.
It is used to convert a string to an integer.
nextLine()
Reason — nextLine() reads the input till the end of line so it can read a full sentence including spaces.
char check (int x)
Reason — The prototype of a function is written in the given syntax:
return_type method_name(arguments)
Thus, the method has the prototype given below:
char check (int x)
POS
Reason — The substring() method returns a substring beginning from the startindex and extending to the character at endIndex - 1. Since a string index begins at 0, the character at index 3 is 'P' and the character at index 5 (6-1 = 5) is 'S'. Thus, "POS" is extracted.
Pure method
Reason — A method which does not modify the value of variables is termed as a pure method.