Java Programming MCQ (Multiple Choice Questions) - SchoolingAxis

Java Programming MCQ (Multiple Choice Questions)

 Que-  Which of these methods sets every element of a List to a specified object?

a. set()

b. fill()

c. Complete()

d. add()


Answer- fill()


Que-  Which of these methods can randomize all elements in a list?

a. rand()

b. randomize()

c. shuffle()

d. ambiguous()


Answer- shuffle()


Que-  Which of these methods can convert an object into a List?

a. SetList()

b. ConvertList()

c. singletonList()

d. CopyList()


Answer- singletonList()


Que-  Which of these is true about unmodifiableCollection() method?

a. unmodifiableCollection() returns a collection that cannot be modified

b. unmodifiableCollection() method is available only for List and Set

c. unmodifiableCollection() is defined in Collection class

d. none of the mentioned


Answer- unmodifiableCollection() method is available only for List and Set


Que-  When does Exceptions in Java arises in code sequence?

a. Run Time

b. Compilation Time

c. Can Occur Any Time

d. None of the mentioned


Answer- Run Time


Que-  Which of these keywords is not a part of exception handling?

a. try

b. finally

c. thrown

d. catch


Answer- thrown


Que-  Which of these keywords must be used to monitor for exceptions?

a. try

b. finally

c. throw

d. catch


Answer- try


Que-  Which of these keywords must be used to handle the exception thrown by try block in some rational manner?

a. try

b. finally

c. throw

d. catch


Answer- catch


Que-  Which of these keywords is used to manually throw an exception?

a. try

b. finally

c. throw

d. catch


Answer- throw


Que-  Which of the following keywords is used for throwing exception manually?

a. finally

b. try

c. throw

d. catch


Answer- throw


Que-  Which of the following classes can catch all exceptions which cannot be caught?

a. RuntimeException

b. Error

c. Exception

d. ParentException


Answer- Error


Que-  Which of the following is a super class of all exception type classes?

a. Catchable

b. RuntimeExceptions

c. String

d. Throwable


Answer- Throwable


Que-  Which of the following operators is used to generate instance of an exception which can be thrown using throw?

a. thrown

b. alloc

c. malloc

d. new


Answer- new


Que-  Which of the following keyword is used by calling function to handle exception thrown by called function?

a. throws

b. throw

c. try

d. catch


Answer- throws


Que-  Which of the following handles the exception when a catch is not used?

a. finally

b. throw handler

c. default handler

d. java run time system


Answer- default handler


Que-  Which part of code gets executed whether exception is caught or not?

a. finally

b. try

c. catch

d. throw


Answer- finally


Que-  Which of the following should be true of the object thrown by a thrown statement?

a. Should be assignable to String type

b. Should be assignable to Exception type

c. Should be assignable to Throwable type

d. Should be assignable to Error type


Answer- Should be assignable to Throwable type


Que-  Which of these is a super class of all exceptional type classes?

a. String

b. RuntimeExceptions

c. Throwable

d. Cacheable


Answer- Throwable


Que-  Which of these class is related to all the exceptions that can be caught by using catch?

a. Error

b. Exception

c. RuntimeExecption

d. All of the mentioned


Answer- Exception


Que-  Which of these class is related to all the exceptions that cannot be caught?

a. Error

b. Exception

c. RuntimeExecption

d. All of the mentioned


Answer- Error


Que-  Which of these handles the exception when no catch is used?

a. Default handler

b. finally

c. throw handler

d. Java run time system


Answer- Default handler


Que-  What exception thrown by parseInt() method?

a. ArithmeticException

b. ClassNotFoundException

c. NullPointerException

d. NumberFormatException


Answer- NumberFormatException


Que-  Which of these keywords is used to generate an exception explicitly?

a. try

b. finally

c. throw

d. catch


Answer- throw


Que-  Which of these class is related to all the exceptions that are explicitly thrown?

a. Error

b. Exception

c. Throwable

d. Throw


Answer- Throwable


Que-  Which of these operator is used to generate an instance of an exception than can be thrown by using throw?

a. new

b. malloc

c. alloc

d. thrown


Answer- new


Que-  Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function?

a. try

b. throw

c. throws

d. catch


Answer- throws


Que-  Which of these clause will be executed even if no exceptions are found?

a. throws

b. finally

c. throw

d. catch


Answer- finally


Que-  A single try block must be followed by which of these?

a. finally

b. catch

c. finally & catch

d. none of the mentioned


Answer- finally & catch


Que-  Which of these exceptions handles the divide by zero error?

a. ArithmeticException

b. MathException

c. IllegalAccessException

d. IllegarException


Answer- ArithmeticException


Que-  Which of these exceptions will occur if we try to access the index of an array beyond its length?

a. ArithmeticException

b. ArrayException

c. ArrayIndexException

d. ArrayIndexOutOfBoundsException


Answer- ArrayIndexOutOfBoundsException

Previous Post Next Post