Object & Classes
- What is the value of “n” after this line of code has been executed?
double n = Math.round ( 4.5 + Math.random() );
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
The Math.random() method returns a number greater than or equal to 0 and less than 1. so 4.5 will be greater than or equal to 4.5 and less than 5.5, we can be sure that Math.round() will round that number to 5.
- Which of these class encapsulate the runtime state of an object or an interface?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
Class
- Which of these classes can schedule task for execution in future?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Timer and TimerTask are the classes that support the ability to schedule tasks for execution at some future time.
- Which of these method is a rounding function of Math class?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
max(), min() and abs() are all rounding functions.
- What is the value of double consonant ‘E’ defined in Math class?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
approximately 2.72