549). Which of these class contains all the methods present in Math class?
[A]SystemMath
[B]StrictMath
[C]Compiler
[D]ClassLoader
Show Answer
Correct Answer: StrictMath
Notes:
Answer: b
Explanation: SystemMath class defines a complete set of mathematical methods that are parallel those in Math class. The difference is that the StrictMath version is guaranteed to generate precisely identical results across all Java implementations.
550). Which of these method return a pseudorandom number?
[A]rand()
[B] random()
[C]randomNumber()
[D]randGenerator()
Show Answer
Correct Answer: random()
Notes:
Answer: b
Explanation: None.
551). Which of these method returns the remainder of dividend / divisor?
[A]remainder()
[B] getRemainder()
[C]CSIremainder()
[D] IEEEremainder()
Show Answer
Correct Answer: IEEEremainder()
Notes:
Answer: d
Explanation: IEEEremainder() returns the remainder of dividend / divisor.
552). Which of these method converts radians to degrees?
[A] toRadian()
[B]toDegree()
[C]convertRadian()
[D]converDegree()
Show Answer
Correct Answer: toDegree()
Notes:
Answer: b
Explanation: None.
553). toRadian() and toDegree() methods were added by which version of Java?
[A]Java 1.0
[B]Java 1.5
[C] Java 2.0
[D] Java 3.0
Show Answer
Correct Answer: Java 2.0
Notes:
Answer: c
Explanation: toRadian() and toDegree() methods were added by Java 2.0 before that there was no method which could directly convert degree into radians and vice versa.
554). Which of these method returns a smallest whole number greater than or equal to variable X?
[A]double ciel(double X)
[B]double floor(double X)
[C]double max(double X)
[D]double min(double X)
Show Answer
Correct Answer: double ciel(double X)
Notes:
Answer: a
Explanation: ciel(double X) returns the smallest whole number greater than or equal to variable X.
555). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
double x = 3.14;
int y = (int) Math.toDegrees(x);
System.out.print(y);
}
}
[A]0
[B]179
[C]180
[D]360
Show Answer
Correct Answer: 179
Notes:
Answer: b
Explanation: 3.14 in degree 179.9087. We usually take it to be 180. Buts here we have type casted it to integer data type hence 179.
Output:$ javac Output.java
$ java Output
179
556). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
double x = 3.14;
int y = (int) Math.toRadians(x);
System.out.print(y);
}
}
Show Answer
Correct Answer: 0
Notes:
Answer: a
Explanation: None.
Output:
$ javac Output.java
$ java Output
0
557). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
double x = 102;
double y = 5;
double z = Math.IEEEremainder(x, y);
System.out.print(z);}
}
}
Show Answer
Correct Answer: 2
Notes:
Answer: c
Explanation: IEEEremainder() returns the remainder of dividend / divisor. Here dividend is 102 and divisor is 5 therefore remainder is 2. It is similar to modulus – ‘%’ operator of C/C++ language.
Output:
$ javac Output.java
$ java Output
2
558). Will this Java program generate same output is executed again?
class Output
{
public static void main(String args[])
{
int y = double z = Math.random();
System.out.print(y);
}
}
[A]Yes
[B]No
[C]Compiler Dependent
[D]Operating System Dependent
Show Answer
Correct Answer: No
Notes:
Answer: b
Explanation: There is no relation between random numbers generated previously in Java.