Mcq On Java Lang

1.Which of the following would compile without error?

A. int a = Math.abs(-5);
B. int b = Math.abs(5.0);
C. int d = Math.abs(5L);
D. int c = Math.abs(5.5F);

View Answer

2. Which of these classes encapsulate runtime state of an object?

A. Class
B. Runtime
C. System
D. Cache

View Answer

3. Which of these classes is not included in java.lang?

A. Class
B. Integer
C. Array
D. Byte

View Answer

4. Which of the following will produce an answer that is closest in value to a double, d, while not being greater than d?

A. (int)Math.abs(d);
B. (int)Math.max(d);
C. (int)Math.min(d);
D. (int)Math.floor(d);

View Answer

5. Which of these methods returns the class of an object?

A. getClass()
B. WhoseObject()
C. Class()
D. WhoseClass()

View Answer

Also check :


* You must be logged in to add comment.