437). Which of these class is a superclass of all other classes?
[A]Math
[B]Process
[C]System
[D]Object
Show Answer
Correct Answer: Object
Notes:
Answer: d
Explanation: The object class class is a superclass of all other classes.
438). Which of these method of Object class can generate duplicate copy of the object on which it is called?
[A]clone()
[B]copy()
[C]duplicate()
[D]dito()
Show Answer
Correct Answer: clone()
Notes:
Answer: a
Explanation: None.
439). What is the value of double consonant āEā defined in Math class?
[A]approximately 3
[B]approximately 3.14
[C]approximately 2.72
[D] approximately 0
Show Answer
Correct Answer: approximately 2.72
Notes:
Answer: c
Explanation: None.
440). Which of these method is a rounding function of Math class?
[A]max()
[B] min()
[C]abs()
[D]all of the mentioned
Show Answer
Correct Answer: all of the mentioned
Notes:
Answer: d
Explanation: max(), min() and abs() are all rounding functions.
441). Which of these class contains only floating point functions?
[A]Math
[B]Process
[C]System
[D]Object
Show Answer
Correct Answer: Math
Notes:
Answer: a
Explanation: Math class contains all the floating point functions that are used for geometry, trigonometry, as well as several general purpose methods. Example : sin(), cos(), exp(), sqrt() etc.
442). Which of these class encapsulate the runtime state of an object or an interface?
[A]Class
[B]Object
[C]Runtime
[D]System
Show Answer
Correct Answer: Class
Notes:
Answer: a
Explanation: None.
443). What is the value of ādā in the following Java code snippet?
double d = Math.round ( 2.5 + Math.random() );
Show Answer
Correct Answer: 3
Notes:
Answer: b
Explanation: The Math.random() method returns a number greater than or equal to 0 and less than 1. so 2.5 will be greater than or equal to 2.5 and less than 3.5, we can be sure that Math.round() will round that number to 3.
444). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int x = 3.14;
int y = (int) Math.abs(x);
System.out.print(y);
}
}
Show Answer
Correct Answer: 3
Notes:
Answer: b
Explanation: None.
Output:
$ javac Output.java
$ java Output
3
445). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
double x = 3.1;
double y = 4.5;
double z = Math.max( x, y );
System.out.print(z);
}
}
[A]true
[B]flase
[C]3.1
[D]4.5
Show Answer
Correct Answer: 4.5
Notes:
Answer: d
Explanation: None.
Output:
$ javac Output.java
$ java Output
4.5
446). What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
double x = 2.0;
double y = 3.0;
double z = Math.pow( x, y );
System.out.print(z);
}
}
[A]2.0
[B]4.0
[C]8.0
[D]9.0
Show Answer
Correct Answer: 8.0
Notes:
Answer: c
Explanation: Math.pow(x, y) methods returns value of y to the power x, i:e x ^ y, 2.0 ^ 3.0 = 8.0.
Output:
$ javac Output.java
$ java Output
8.0