InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What Will Math. Random () Do? |
|
Answer» The RANDOM () METHOD RETURNS random number between 0.0 and 1.0. It ALWAYS returns double. The random () method returns random number between 0.0 and 1.0. It always returns double. |
|
| 2. |
What Will Math.min () Do? |
|
Answer» The MIN () METHOD RETURNS smaller value out of the SUPPLIED VALUES. The min () method returns smaller value out of the supplied values. |
|
| 3. |
What Will Math.max () Do? |
|
Answer» The max () method RETURNS greater value out of the SUPPLIED VALUES. The max () method returns greater value out of the supplied values. |
|
| 4. |
What Will Math. Floor () Do? |
|
Answer» This METHOD returns ALWAYS DOUBLE, which is not GREATER than the supplied VALUE. This method returns always double, which is not greater than the supplied value. |
|
| 5. |
What Will Math. Ceil() Do? |
|
Answer» This METHOD returns always double, which is not LESS than the supplied value. It returns NEXT AVAILABLE WHOLE number. This method returns always double, which is not less than the supplied value. It returns next available whole number. |
|
| 6. |
What Will Math.abs () Do? |
|
Answer» It simply returns the absolute value of the value supplied to the method, i.e. GIVES you the same value. If you supply NEGATIVE value it simply REMOVES the sign. It simply returns the absolute value of the value supplied to the method, i.e. gives you the same value. If you supply negative value it simply removes the sign. |
|
| 7. |
Can You Instantiate Math Class? |
|
Answer» No. It cannot be instantiated. The class is FINAL and its constructor is PRIVATE. But all the methods are static, so we can use them WITHOUT INSTANTIATING the Math class. No. It cannot be instantiated. The class is final and its constructor is private. But all the methods are static, so we can use them without instantiating the Math class. |
|
| 8. |
What Is The Use Of Math Class? |
|
Answer» MATH class PROVIDES METHODS for MATHEMATICAL functions. Math class provides methods for mathematical functions. |
|
| 9. |
What Is The Difference Between String And String Buffer? |
|
Answer» OBJECT's of STRING class is immutable and object's of StringBuffer class is mutable MOREOVER String buffer is FASTER in CONCATENATION. Object's of String class is immutable and object's of StringBuffer class is mutable moreover String buffer is faster in concatenation. |
|
| 10. |
What Is The Possible Runtime Exception Thrown By Sub String () Method? |
|
Answer» ArrayIndexOutOfBoundsException. ArrayIndexOutOfBoundsException. |
|
| 11. |
What Is The Use Of Java.lang. Class Class? |
|
Answer» The JAVA.lang. Class class is used to REPRESENT the classes and INTERFACES that are loaded by a java PROGRAM. The java.lang. Class class is used to represent the classes and interfaces that are loaded by a java program. |
|
| 12. |
What Will Trim () Method Of String Class Do? |
|
Answer» TRIM () ELIMINATE SPACES from both the ENDS of a STRING. Trim () eliminate spaces from both the ends of a string. |
|
| 13. |
What Is The Difference Between An Object And Object Reference? |
|
Answer» An OBJECT is an INSTANCE of a CLASS. Object reference is a pointer to the object. There can be MANY REFERENCES to the same object. An object is an instance of a class. Object reference is a pointer to the object. There can be many references to the same object. |
|
| 14. |
How Many Objects Are In The Memory After The Exaction Of Following Code Segment? |
|
Answer» STRING str1 = "ABC"; String str2 = "XYZ"; String str1 = str1 + str2; String str1 = "ABC"; String str2 = "XYZ"; String str1 = str1 + str2; There are 3 Objects. |
|
| 15. |
How Will You Find Length Of A String Object? |
|
Answer» USING LENGTH () METHOD of STRING CLASS. Using length () method of String class. |
|
| 16. |
Is String A Wrapper Class Or Not? |
|
Answer» No. STRING is not a WRAPPER CLASS. No. String is not a Wrapper class. |
|
| 17. |
Why Most Of The Thread Functionality Is Specified In Object Class? |
|
Answer» BASICALLY for interthread COMMUNICATION. Basically for interthread communication. |
|
| 18. |
What Do You Think Is The Logic Behind Having A Single Base Class For All Classes? |
| Answer» | |