Java Programming Multiple Choice Questions - Java Lang

This section focuses on the "Java Lang" in Java programming. These Multiple Choice Questions (MCQ) should be practiced to improve the Java programming skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements and other competitive examinations.

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


6. Which of these class have only one field "TYPE"?

A. Void
B. Process
C. System
D. Runtime

View Answer


7. Which of the following method of Process class can terminate a process?

A. void kill()
B. void destroy()
C. void terminate()
D. void exit()

View Answer


8. Standard output variable "out" is defined in which class?

A. Void
B. Process
C. Runtime
D. System

View Answer


9. Which of these class can encapsulate an entire executing program?

A. Void
B. Process
C. Runtime
D. System

View Answer


10. Which of the following is method of System class is used to find how long a program takes to execute?

A. currenttime()
B. currentTime()
C. currentTimeMillis()
D. currenttimeMillis()

View Answer


11. Which of these is a process of converting a simple data type into a class?

A. type casting
B. type conversion
C. type wrapping
D. None of the Mentioned

View Answer


12. Which of the following is method of wrapper Float for converting the value of an object into byte?

A. Bytevalue()
B. byte bytevalue()
C. bytevalue()
D. Byte Bytevalue()

View Answer


13. Which of these methods is used to check for infinitely large and small values?

A. isInfinite()
B. Isinfinite()
C. isNaN()
D. IsNaN()

View Answer


14. Which of the following methods is a method of wrapper Integer for obtaining hash code for the invoking object?

A. Integer hashcode()
B. int hashcode()
C. int hashCode()
D. int hash()

View Answer


15. Which of the following method of Process class can terminate a process??

A. void terminate()
B. void destroy()
C. void exit()
D. void kill()

View Answer





Also check :

Discussion



* You must be logged in to add comment.