Java Programming Multiple Choice Questions - Java Lang

This section focuses on the "Java Lang" of the Java programming. These Multiple Choice Questions (mcq) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam 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







Also check :


Discussion


* You must be logged in to add comment.