Java Programming MCQ (Multiple Choice Questions) - SchoolingAxis

Java Programming MCQ (Multiple Choice Questions)

 Que-  Which of these methods is used to check for infinitely large and small values?

a. isInfinite()

b. isNaN()

c. Isinfinite()

d. IsNaN()


Answer- isInfinite()


Que-  Which of the following package stores all the simple data types in java?

a. lang

b. java

c. util

d. java.packages


Answer- lang


Que-  Which of these is a wrapper for data type int?

a. Integer

b. Long

c. Byte

d. Double


Answer- Integer


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

a. int hash()

b. int hashcode()

c. int hashCode()

d. Integer hashcode()


Answer- int hashCode()


Que-  Which of these is a super class of wrappers Long, Character & Integer?

a. Long

b. Digits

c. Float

d. Number


Answer- Number


Que-  Which of these is a wrapper for simple data type char?

a. Float

b. Character

c. String

d. Integer


Answer- Character


Que-  Which of the following is method of wrapper Integer for converting the value of an object into int?

a. bytevalue()

b. int intValue();

c. Bytevalue()

d. Byte Bytevalue()


Answer- int intValue();


Que-  Which of these methods is used to obtain value of invoking object as a long?

a. long value()

b. long longValue()

c. Long longvalue()

d. Long Longvalue()


Answer- long longValue()


Que-  Which of these class have only one field 'TYPE'?

a. Void

b. Process

c. System

d. Runtime


Answer- Void


Que-  Which of the following method of Process class can terminate a process?

a. void kill()

b. void destroy()

c. void terminate()

d. void exit()


Answer- void destroy()


Que-  Standard output variable 'out' is defined in which class?

a. Void

b. Process

c. Runtime

d. System


Answer- System


Que-  Which of these class can encapsulate an entire executing program?

a. Void

b. Process

c. Runtime

d. System


Answer- Process


Que-  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()


Answer- currentTimeMillis()


Que-  Which of these class holds a collection of static methods and variables?

a. Void

b. Process

c. Runtime

d. System


Answer- System


Que-  Which of these class is a superclass of all other classes?

a. Math

b. Process

c. System

d. Object


Answer- Object


Que-  Which of these method of Object class can generate duplicate copy of the object on which it is called?

a. clone()

b. copy()

c. duplicate()

d. dito()


Answer- clone()


Que-  What is the value of double consonant 'E' defined in Math class?

a. approximately 3

b. approximately 3.14

c. approximately 2.72

d. approximately 0


Answer- approximately 2.72


Que-  Which of these method is a rounding function of Math class?

a. max()

b. min()

c. abs()

d. all of the mentioned


Answer- all of the mentioned


Que-  Which of these class contains only floating point functions?

a. Math

b. Process

c. System

d. Object


Answer- Math


Que-  Which of these class encapsulate the runtime state of an object or an interface?

a. Class

b. Object

c. Runtime

d. System


Answer- Class


Que-  What is the value of "d" in the following Java code snippet?  double d = Math.round ( 2.5 + Math.random() );

a.2

b.3

c.4

d.2.5


Answer-3


Que-  Which of these exceptions is thrown by methods of System class?

a. IOException

b. SystemException

c. SecurityException

d. InputOutputException


Answer- SecurityException


Que-  Which of these methods initiates garbage collection?

a. gc()

b. garbage()

c. garbagecollection()

d. Systemgarbagecollection()


Answer- gc()


Que-  Which of these methods loads the specified dynamic library?

a. load()

b. library()

c. loadlib()

d. loadlibrary()


Answer- load()

Previous Post Next Post