Chapter: Exception handling in Java โข Total: 175 MCQs
MCQ 1Run-time errors
When we try to divide an integer numbers by zero what will be the exception generated?
ANullPointerException
BNumberFormatException
CArithmeticException
DAll of the above
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 2The Finally blocks
In JAVA,the numbers of finally blocks followed in each try block is/are ?
A2
B3
C1
D5
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 3The try Block
Which type of code cotained by a try block?
ATo handle exceptions of particular type that were created in the associated try block
BRaise to one or mre exceptions
CExecuted before the program end
DAll of the above
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 4The catch block
Who can identify the type of exception that a Catch block is to deal?
AFile
Bvariable
Cparameter
Dfunctionย
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 5The Throw Clause
In java, which clause is used within the method or a constracter that may genterate an exception?
Athrow
Bthrows
Ccatch
Dfinally
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 6The Finally blocks
Which block is always executed , regardless of whether or not expection are thrown during the execution of the associated try block?
Afinally
Bcatch
C(a) and (b) both
Dthrow
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 7Run-time errors
WHICH EXCEPTION CLASS IS OBSERVED WHEN AN ATTEMPT TO ACCESS THE ARRAY ELEMENT WITH AN INDEX VALUE THAT IS OUTSIDE THE RANGE OF ARRAY IN JAVA
AARRY OUT OF BOX
BARRAY OUT OF INDEX
CARRAY BOUNDS
DNOT FOUND ARRAY
Correct Answer: Option B
Note: null
MCQ 8The Finally blocks
WHICH BLOCK IS GENERALLY USED TO CLEAN UP AT THE END OF EXECUTING A TRY BLOCK.
AFINALLY
BCATCH
CTRY
DTHROWS
Correct Answer: Option A
Note: null
MCQ 9Types of Exceptions
IN OBJECT-ORINTED PROGRAMING, WHAT IS AN INDICATION OF PROBLEM WHICH OCCURS DURING EXECUTION.
AFUNCTION
BSTRING (CHAR ARY [])
CARRAY BOUNDS
DEXCEPETION
Correct Answer: Option D
Note: null
MCQ 10Compile-time errors
IN JAVA IN WHICH CONDITION PROGRAM WILL GET A COMPILATION ERROR AND NOT BE ABLE TO CREATE ".CLASS" FILE.
ASYNTAX ERROR
BUSE OF UNDECLARED variable
CWRONG SPELING
DALL OF THESE
Correct Answer: Option D
Note: null
MCQ 11The try Block
WHICH TYPE OF BLOCK CONTAINS THE CODE THAT MANY GIVE RISE TO ONE OR MORE EXCEPTIONS IN JAVA?
ATRY
BCATCH
CTHROW
DFINALLY
Correct Answer: Option A
Note: null
MCQ 12Exception Handling
WHICH BLOCK CONTAINS THE CODE THAT IS TO BE EXECUTED TO HANDLE AN EXCEPTION KEYWORD.
ATRY
BCATCH
CFINALLY
DTHROWOBJ
Correct Answer: Option B
Note: null
MCQ 13Types of Exceptions
Which of the following is an advantage of using a try ..... catch block?
AExceptional events are eliminated
BExceptional events are reduced
CExceptional events are integrated with the regular events
DExceptional events are isolated from regular events
Correct Answer: Option C
MCQ 14Types of Exceptions
Which program is error free and will always be executed successfully?
Acomplied
Binterpreted
Cdebug
Dcoded
Correct Answer: Option A
Note: null
MCQ 15Types of Exceptions
What is an indication of a problem that occurs during a program's execution which usually signals an error?
AException
Bcompiled
Cinterpreted
Dcoded
Correct Answer: Option A
Note: null
MCQ 16Types of Exceptions
Which of the following allows a program to continue executing as if no problem had been encountered or it may modify the use of the program before terminating in an uncontrolled manner?
AException handling
Btermination
CException code
DError
Correct Answer: Option A
Note: null
MCQ 17Types of Exceptions
What is called all kinds of error conditions in Java?
AExceptions
BWarm
CCompilation
Dtermination
Correct Answer: Option A
Note: null
MCQ 18Types of Exceptions
What is used to convert source code into object code?
Acompiler
BInterpretation
CTermination
Ddebugging
Correct Answer: Option A
Note: null
MCQ 19Types of Exceptions
If there is a syntax error in the program we will get a compilation error and will not be able to create the โฆโฆโฆโฆโฆ.file.
Aclass
Bjava
Cjavac
Ddocument
Correct Answer: Option A
Note: null
MCQ 20Types of Exceptions
In how many categories, Error can be broadly classified?
ACompile-time errors
BRun-time errors
Cexe time
Dboth a and b
Correct Answer: Option D
Note: null
MCQ 21Types of Exceptions
Which of the following are the common syntax errors in Java programs?
AMissing semicolon, Use of undeclared variable
BWrong spellings of identifier or keyword
CMismatch of bracket
DAll of above
Correct Answer: Option D
Note: null
MCQ 22Types of Exceptions
Which type of errors are usually the mistakes of programmer?
ACompile-time errors
BRun-time errors
CExe time
DNone of above
Correct Answer: Option A
Note: null
MCQ 23Types of Exceptions
If there are no syntax errors in the source code then the program will compile successfully and we will get a โฆโฆโฆโฆโฆโฆ file.
Aclass
Bjava
Cjavac
Ddocument
Correct Answer: Option A
Note: null
MCQ 24Types of Exceptions
In โฆโฆโฆโฆ..exception, the exception will be generated during runtime in Java.
ACompile-time
BRun-time
CExe time
DNone of above
Correct Answer: Option B
Note: null
MCQ 25Types of Exceptions
In the field of Computer Science, indicates whether the command or a program is executed successfully or not.
AโExit codeโ
BโExit statusโ
CExit
DBoth a or b
Correct Answer: Option D
Note: null
MCQ 26Types of Exceptions
Which code indicates that the command has been executed successfully?
ACode โ0โ
BExit 0
Ctext 0
DCode 1
Correct Answer: Option A
Note: S-March-2020
MCQ 27Types of Exceptions
Which code indicates that some problem has occurred while executing the command?
ACode โ0โ
BExit 0
Ctext 0
DCode โ1โ
Correct Answer: Option D
Note: null
MCQ 28Types of Exceptions
Which package contains a hierarchy of dealing with various exceptions?
AJava.lang
Bjava.io
Cjava.*
Dboth a and b
Correct Answer: Option D
Note: null
MCQ 29Types of Exceptions
An attempt to access the array element with an index value that is outside the range of array uses Which of the following exception. Ex. A[13]=99;
AArrayIndexOutOfBound
BArrayOutOfBound
CArrayIndex
DArrayIndOutBound
Correct Answer: Option A
Note: null
MCQ 30Types of Exceptions
An attempt to divide any number by 0 (zero) uses which of the following exception. Ex. Int a=50/0;
AArithmeticException
BArrayIndexOutOfBound
CArithException
DNumberFormatException
Correct Answer: Option A
Note: null
MCQ 31Types of Exceptions
An attempt to use null in a case where an object is required uses Which of the following exception. Example - String s=null; System.out.println(s.lengh());
ANullPointerException
BArithmeticException
CArrayIndexOutOfBound
DAll
Correct Answer: Option A
Note: null
MCQ 32Types of Exceptions
An attempt to convert string to a number type uses which of the following exception? Example- String s=โxyzโ int i=Integer.parseInt(s);
ANumberFormatException
BAirthmeticException
CArrayIndexOutOfBound
DNullPointer
Correct Answer: Option A
Note: null
MCQ 33Types of Exceptions
An I/O error has occurred while printing uses which of the following exception?
APrinterIOException
BNullPointerException
CArrayIndexException
DNullPrinter
Correct Answer: Option A
Note: null
MCQ 34Types of Exceptions
Which type of keywords are used to write an exception handler in Java?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option D
Note: null
MCQ 35Types of Exceptions
Which keywords are used in the presence of exception which represent block of statements?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option D
Note: null
MCQ 36Types of Exceptions
Which block contains the code that may give rise to one or more exceptions?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option A
Note: null
MCQ 37Types of Exceptions
Which block contains the code that is intended to handle exceptions of a particular type that were created in the associated try block?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option B
Note: null
MCQ 38Types of Exceptions
Which block is always executed before the program ends, regardless of whether any exceptions are generated in the try block or not?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option C
Note: null
MCQ 39Types of Exceptions
Which of the following statement contains a block of statements within the curly braces?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option A
Note: null
MCQ 40Types of Exceptions
Which is the code that we want to monitor for exceptions, if a problem occurs during its execution, an exception is thrown?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option A
Note: null
MCQ 41Types of Exceptions
Which block must immediately follow the try block?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option B
Note: null
MCQ 42Types of Exceptions
Which block contains the code that is to be executed to handle an exception?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option B
Note: null
MCQ 43Types of Exceptions
Which block is an exception handler, for a single try block there can be one or more catch blocks?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option B
Note: null
MCQ 44Types of Exceptions
Which block contains a reference to an object which was created and thrown by the try block?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option B
Note: null
MCQ 45Types of Exceptions
Which block is generally used to clean up at the end of executing a try block?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option C
Note: null
MCQ 46Types of Exceptions
Which block is used when we want to be sure that some particular code is to run, no matter what exceptions are thrown within the associated try block?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option C
Note: null
MCQ 47Types of Exceptions
Which block is widely used if a file needs to be closed or a critical resource is to be released at the completion of the program?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option C
Note: null
MCQ 48Types of Exceptions
Which block must always be followed by at least one block that is either a catch block or a finally block?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option A
Note: null
MCQ 49Types of Exceptions
Which block is associated with a particular try block and it must be located immediately following any catch blocks for the corresponding try block?
Atry
Bcatch
Cfinally
Dthrow
Correct Answer: Option C
Note: null
MCQ 50Types of Exceptions
Which keyword is used to explicitly throw an Exception object?
Atry
Bcatch
Cfinally
Dthrow
Correct Answer: Option D
Note: null
MCQ 51Types of Exceptions
Who created an exception object and was throwing it automatically?
AJVM
BJDK
CJRE
DUML
Correct Answer: Option A
Note: null
MCQ 52Types of Exceptions
The syntax to throw an exception object is :
Athrow exception object;
Bthrow object;
Cthrew object
DTHROW
Correct Answer: Option A
Note: null
MCQ 53Types of Exceptions
Which cause can be used in a method declaration or constructor declaration to inform that the code within the constructor or method may throw an Exception?
Atry
Bcatch
Cfinally
Dthrows
Correct Answer: Option D
Note: null
MCQ 54Types of Exceptions
Which exception classes are not provided by the Java for application specific exceptions?
ABuilt-in
Buser define
Cmethod
Dconstructor
Correct Answer: Option A
Note: null
MCQ 55Types of Exceptions
Which method of the Scanner class helps in reading integer input from the console?
AnextInt()
BInt( )
Cnextint( )
DNEXTINT( )
Correct Answer: Option A
Note: null
MCQ 56Types of Exceptions
In Java, which of the following is not a proper example of common syntax errors?
AMismatch of bracket
BUse of undeclared variable
CAn attempt to-divide any number by 0
DWrong spelling of identifier or keyword
Correct Answer: Option C
Note: G-March-2022
MCQ 57Types of Exceptions
In Java, which of the following blocks is always executed before the program ends, regardless of whether any exceptions are generated in the try block or not?
Athrow statement
Bthrows clause
Ccatch block
Dfinally block
Correct Answer: Option D
Note: G-March-2022
MCQ 58Types of Exceptions
In Java, which type of object must be there, to create an exception object and throw it explicitly otherwise compile error occurs?
Ajava.lang.Throwable
Bjava.util.Throwable
Cjava.Throwable
Djava.Throwable.Exception
Correct Answer: Option A
Note: G-March-2022
MCQ 59Types of Exceptions
In Java, which of the following can be used in a method declaration or constructor declaration to inform that the code within the constructor or method may throw an Exception?
Acatch block
Bfinally block
Cthrows clause
Dthrow statement
Correct Answer: Option D
Note: G-March-2022
MCQ 60Types of Exceptions
Which of the following blocks in Java, contains the code that we want to monitor for exceptions?
Acatch block
Btry block
Cfinally block
Dthrows clause
Correct Answer: Option B
Note: G-March-2022
MCQ 61Types of Exceptions
In Java, which code indicates that some problem occurred while executing the command?
AExit code: 0
BExit code: 1
CExit code: -1
DExit code: -2
Correct Answer: Option B
Note: G-March-2022
MCQ 62The try Block
Which of the following elements are not included in try block?
Athe keyword try
Bthe keyword catch
Cthe curly bracket
Dstatements that might cause exceptions
Correct Answer: Option B
Note: G-March-2019
MCQ 63The catch block
In Java, which of the following block handles or takes appropriate action when an exception occurs?
Atry
Bcatch
Cthrows
Dhandles
Correct Answer: Option B
Note: G-March-2019
MCQ 64The Finally blocks
Which clause signifies that there is no catch block within the method that can handle the exception?
Athrows
Bif
Cloop
Darray
Correct Answer: Option A
Note: S-March-2020
MCQ 65Types of Exceptions
By which of the following, an object of arithmetic exception is thrown?
Athrow keyword
Btry keyword
CJVM
Dthrow object
Correct Answer: Option C
Note: null
MCQ 66Types of Exceptions
What type of an error occurs when there is a mismatch of bracket in Java program?
ACompile-time error
BRun-time error
CBoth A and B
DNone of the given
Correct Answer: Option A
Note: null
MCQ 67Types of Exceptions
Which keyword is used to handle exceptions of a Java program?
Acatch
Btry
Cfinally
DAll of the given
Correct Answer: Option A
Note: null
MCQ 68Types of Exceptions
Which exception class will be applied for the following Java coding? int a[] = new int[4]: a[13] = 99;
AArithmeticException
BArrayIndexOutOfBoundsException
CNullPointerException
DNumberFormatException
Correct Answer: Option B
Note: null
MCQ 69Types of Exceptions
For a single try block there can be ____________________ catch blocks.
Aonly one
Btwo
Cthree
Done or more
Correct Answer: Option D
Note: null
MCQ 70Types of Exceptions
Which of the following is an advantage of exception handling in Java?
AIt allows writing separate error handling code from the normal code.
BError types can be grouped and differentiated within the program.
CAssertions can be used to debug the program before deploying it to the clients.
DAll of the given
Correct Answer: Option D
Note: null
MCQ 71Types of Exceptions
The object that is to be thrown using the keyword throw, must be of __________ type.
Ajava.lang.int
Bjava.lang.string
Cjava.lang.throw
Djava.lang.throwable
Correct Answer: Option D
Note: null
MCQ 72Types of Exceptions
In the field of computer science, which of the following indicates whether the command or program is executed successfully or not?
AReturn code
BExit code
CExit status
DB or C
Correct Answer: Option D
Note: null
MCQ 73Types of Exceptions
In Java, which block contains the code that may give rise to one or more exceptions?
Acatch
Btry
Cfinally
Dthrow
Correct Answer: Option B
Note: null
MCQ 74Types of Exceptions
Which of the following exception occurs when a string is converted to a number type?
ANullPointerException
BArithmeticException
CStringException
DNumberFormatException
Correct Answer: Option D
Note: null
MCQ 75Types of Exceptions
___________ blocked is widely used if a file needs to be closed at the completion of the program.
Afinally
Btry
Ccatch
Dthrow
Correct Answer: Option A
Note: null
MCQ 76Types of Exceptions
A method can throw_____________ exceptions.
Aone
Bmaximum
Cmultiple
DNone of the given
Correct Answer: Option C
Note: null
MCQ 77Types of Exceptions
Which block is added to handle the exception object that is explicitly thrown by keyword throw?
Afinally
Bcatch
Ctry
DNone of the given
Correct Answer: Option B
Note: null
MCQ 78Types of Exceptions
Which code in Java indicates that the command/program is executed successfully?
A1
B0
C-1
Derr
Correct Answer: Option B
Note: null
MCQ 79Types of Exceptions
Which of the following code contains the instructions that is intended to handle exceptions of a particular type?
Athrow
Btry
Ccatch
Dfinally
Correct Answer: Option C
Note: null
MCQ 80Types of Exceptions
Which of the following exception occurs when an attempt is made to access a non-existing file?
ANullPointerException
BArithmeticException
CFileNotFoundException
DNoFileException
Correct Answer: Option C
Note: null
MCQ 81Types of Exceptions
A block is used when a critical resource is to be released at the completion of the program.
Atry
Bcatch
Cfinally
DNone of the given
Correct Answer: Option C
Note: null
MCQ 82Types of Exceptions
The Java program will not get executed if ____________ block/s is/are not positioned correctly.
Afinally
Bcatch
CA or B
DNone of the given
Correct Answer: Option C
Note: null
MCQ 83Types of Exceptions
Each type of exception that a method can throw must be stated at which of the following place in method?
AIn header
BIn footer
COut of the program
DDuring the execution of program
Correct Answer: Option A
Note: null
MCQ 84Types of Exceptions
Which of the following code indicates that some problem has occurred in executing the program and the command is not successfully executed?
A0
B1
C2
D-1
Correct Answer: Option B
Note: null
MCQ 85Types of Exceptions
When is finally block used?
ABefore the program terminates
BAfter the program terminates
CIn the beginning of the program
DNone of the given
Correct Answer: Option A
Note: null
MCQ 86Types of Exceptions
Which exception class will be applied for Java coding int a = 50/0;?
AArithmeticException
BArrayIndexOutOfBoundsException
CNullPointerException
DNumberFormatException
Correct Answer: Option A
Note: null
MCQ 87Types of Exceptions
Which of the following package contains a hierarchy of classes dealing with various exceptions?
AJava.lang
Bjava.io
CBoth A and B
DNone of the given
Correct Answer: Option C
Note: null
MCQ 88Types of Exceptions
The finally block is generally used to __________________ at the end of executing a try block.
Aclean up
Bcompile
Csummary
Dend program
Correct Answer: Option A
Note: null
MCQ 89Types of Exceptions
Which of the following class in Java is used to accept input from the keyboard?
Ajava.util
Bjava.lang.scanner
CJava.input
Djava.lang.util
Correct Answer: Option B
Note: null
MCQ 90Types of Exceptions
By performing which of the following action, ".class" file can be created?
AWhen java program is executed (being run)
BWhen java program is compiled
CWhen java source code is saved (stored)
DAll of the given
Correct Answer: Option B
Note: null
MCQ 91Types of Exceptions
Which of the following block contains the instructions that may give rise to exceptions?
Atry
Bcatch
Cthrow
Dfinally
Correct Answer: Option A
Note: null
MCQ 92Types of Exceptions
Which exception class will be applied for the following Java coding? String S = null; System.out.println(s.length( ));
AArithmeticException
BNullPointerException
CNumberFormatException
DNone of the given
Correct Answer: Option B
Note: null
MCQ 93Types of Exceptions
A catch block consists of the keyword catch followed by a single parameter in _____
A( )
B{ }
C[ ]
D<>
Correct Answer: Option A
Note: null
MCQ 94Types of Exceptions
A _____________ block is always executed, regardless of whether or not exceptions are thrown during the execution of the associated try block.
Afinally
Bcatch
Cthrow
DNone of the given
Correct Answer: Option A
Note: null
MCQ 95Types of Exceptions
The ___________ method of the scanner class helps in reading integer input from the console.
AreadInt( )
Bnext Number ( )
CnextInt( )
DAll of the given
Correct Answer: Option C
Note: null
MCQ 96Types of Exceptions
______________ package contains a hierarchy of classes dealing with various exceptions.
Ajava.lang
Bjava.io
CBoth A and B
DNone of the given
Correct Answer: Option C
Note: null
MCQ 97Types of Exceptions
Which block must immediately follow the try block?
Acatch
Bthrow
Cfinally
DA or C
Correct Answer: Option D
Note: null
MCQ 98Types of Exceptions
Which exception class will be applied for the following Java coding? String s = "XYZ"; int i = Integer.parseInt(s);
AArithmeticException
BNullPointerException
CNumberFormatException
DNone of the given
Correct Answer: Option C
Note: null
MCQ 99Types of Exceptions
Java uses keyword/s like ___________________ to write an exception handler.
Atry
Bcatch
Cfinally
DAll of the given
Correct Answer: Option D
Note: null
MCQ 100Types of Exceptions
Which of the following exception class is not provided in Java?
AArithmeticException
BNullPointerException
CPrinterIOException
DFileException
Correct Answer: Option D
Note: null
MCQ 101Run-time errors
When we try to divide an integer numbers by zero what will be the exception generated?
ANullPointerException
BNumberFormatException
CArithmeticException
DAll of the above
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 102The Finally blocks
In JAVA,the numbers of finally blocks followed in each try block is/are ?
A2
B3
C1
D5
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 103Creating Custom Exception
which of the following classes cannot be used to create anย object ?
Ajava.io.Reader
Bjava.io.writer
Cjava.lang.throwableย
D(A)and(B)both
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 104The try Block
Which type of code cotained by a try block?
ATo handle exceptions of particular type that were created in the associated try block
BRaise to one or mre exceptions
CExecuted before the program end
DAll of the above
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 105The catch block
Who can identify the type of exception that a Catch block is to deal?
AFile
Bvariable
Cparameter
Dfunctionย
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 106The Throw Clause
In java, which clause is used within the method or a constracter that may genterate an exception?
Athrow
Bthrows
Ccatch
Dfinally
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 107The Finally blocks
Which block is always executed , regardless of whether or not expection are thrown during the execution of the associated try block?
Afinally
Bcatch
C(a) and (b) both
Dthrow
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 108Types of Exceptions
Which code indicates that the command has been executed successfully?
ACode โ0โ
BExit 0
Ctext 0
DCode 1
Correct Answer: Option A
Note: S-March-2020
MCQ 109Types of Exceptions
In Java, which of the following is not a proper example of common syntax errors?
AMismatch of bracket
BUse of undeclared variable
CAn attempt to-divide any number by 0
DWrong spelling of identifier or keyword
Correct Answer: Option C
Note: G-March-2022
MCQ 110Types of Exceptions
In Java, which of the following blocks is always executed before the program ends, regardless of whether any exceptions are generated in the try block or not?
Athrow statement
Bthrows clause
Ccatch block
Dfinally block
Correct Answer: Option D
Note: G-March-2022
MCQ 111Types of Exceptions
In Java, which type of object must be there, to create an exception object and throw it explicitly otherwise compile error occurs?
Ajava.lang.Throwable
Bjava.util.Throwable
Cjava.Throwable
Djava.Throwable.Exception
Correct Answer: Option A
Note: G-March-2022
MCQ 112Types of Exceptions
In Java, which of the following can be used in a method declaration or constructor declaration to inform that the code within the constructor or method may throw an Exception?
Acatch block
Bfinally block
Cthrows clause
Dthrow statement
Correct Answer: Option D
Note: G-March-2022
MCQ 113Types of Exceptions
Which of the following blocks in Java, contains the code that we want to monitor for exceptions?
Acatch block
Btry block
Cfinally block
Dthrows clause
Correct Answer: Option B
Note: G-March-2022
MCQ 114Types of Exceptions
In Java, which code indicates that some problem occurred while executing the command?
AExit code: 0
BExit code: 1
CExit code: -1
DExit code: -2
Correct Answer: Option B
Note: G-March-2022
MCQ 115The Finally blocks
Which clause signifies that there is no catch block within the method that can handle the exception?
Athrows
Bif
Cloop
Darray
Correct Answer: Option A
Note: S-March-2020
MCQ 116Run-time errors
WHICH EXCEPTION CLASS IS OBSERVED WHEN AN ATTEMPT TO ACCESS THE ARRAY ELEMENT WITH AN INDEX VALUE THAT IS OUTSIDE THE RANGE OF ARRAY IN JAVA
AARRY OUT OF BOX
BARRAY OUT OF INDEX
CARRAY BOUNDS
DNOT FOUND ARRAY
Correct Answer: Option B
Note: null
MCQ 117Compile-time errors
IN JAVA IN WHICH CONDITION PROGRAM WILL GET A COMPILATION ERROR AND NOT BE ABLE TO CREATE ".CLASS" FILE.
ASYNTAX ERROR
BUSE OF UNDECLARED variable
CWRONG SPELING
DALL OF THESE
Correct Answer: Option D
Note: null
MCQ 118Types of Exceptions
Which of the following is an advantage of using a try ..... catch block?
AExceptional events are eliminated
BExceptional events are reduced
CExceptional events are integrated with the regular events
DExceptional events are isolated from regular events
Correct Answer: Option C
MCQ 119Types of Exceptions
Which type of errors are usually the mistakes of programmer?
ACompile-time errors
BRun-time errors
CExe time
DNone of above
Correct Answer: Option A
Note: null
MCQ 120Types of Exceptions
In the field of Computer Science, indicates whether the command or a program is executed successfully or not.
AโExit codeโ
BโExit statusโ
CExit
DBoth a or b
Correct Answer: Option D
Note: null
MCQ 121Types of Exceptions
Which block is an exception handler, for a single try block there can be one or more catch blocks?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option B
Note: null
MCQ 122Types of Exceptions
Who created an exception object and was throwing it automatically?
AJVM
BJDK
CJRE
DUML
Correct Answer: Option A
Note: null
MCQ 123Types of Exceptions
Which exception classes are not provided by the Java for application specific exceptions?
ABuilt-in
Buser define
Cmethod
Dconstructor
Correct Answer: Option A
Note: null
MCQ 124Types of Exceptions
Which method of the Scanner class helps in reading integer input from the console?
AnextInt()
BInt( )
Cnextint( )
DNEXTINT( )
Correct Answer: Option A
Note: null
MCQ 125The try Block
Which of the following elements are not included in try block?
Athe keyword try
Bthe keyword catch
Cthe curly bracket
Dstatements that might cause exceptions
Correct Answer: Option B
Note: G-March-2019
MCQ 126The catch block
In Java, which of the following block handles or takes appropriate action when an exception occurs?
Atry
Bcatch
Cthrows
Dhandles
Correct Answer: Option B
Note: G-March-2019
MCQ 127Types of Exceptions
Which of the following exception occurs when an attempt is made to access a non-existing file?
ANullPointerException
BArithmeticException
CFileNotFoundException
DNoFileException
Correct Answer: Option C
Note: null
MCQ 128Types of Exceptions
The Java program will not get executed if ____________ block/s is/are not positioned correctly.
Afinally
Bcatch
CA or B
DNone of the given
Correct Answer: Option C
Note: null
MCQ 129Types of Exceptions
Which of the following code indicates that some problem has occurred in executing the program and the command is not successfully executed?
A0
B1
C2
D-1
Correct Answer: Option B
Note: null
MCQ 130Types of Exceptions
When is finally block used?
ABefore the program terminates
BAfter the program terminates
CIn the beginning of the program
DNone of the given
Correct Answer: Option A
Note: null
MCQ 131Types of Exceptions
The finally block is generally used to __________________ at the end of executing a try block.
Aclean up
Bcompile
Csummary
Dend program
Correct Answer: Option A
Note: null
MCQ 132Types of Exceptions
______________ package contains a hierarchy of classes dealing with various exceptions.
Ajava.lang
Bjava.io
CBoth A and B
DNone of the given
Correct Answer: Option C
Note: null
MCQ 133The Finally blocks
In JAVA,the numbers of finally blocks followed in each try block is/are ?
A2
B3
C1
D5
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 134The try Block
Which type of code cotained by a try block?
ATo handle exceptions of particular type that were created in the associated try block
BRaise to one or mre exceptions
CExecuted before the program end
DAll of the above
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 135The catch block
Who can identify the type of exception that a Catch block is to deal?
AFile
Bvariable
Cparameter
Dfunctionย
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 136The Finally blocks
Which block is always executed , regardless of whether or not expection are thrown during the execution of the associated try block?
Afinally
Bcatch
C(a) and (b) both
Dthrow
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 137Types of Exceptions
In Java, which of the following is not a proper example of common syntax errors?
AMismatch of bracket
BUse of undeclared variable
CAn attempt to-divide any number by 0
DWrong spelling of identifier or keyword
Correct Answer: Option C
Note: G-March-2022
MCQ 138Types of Exceptions
In Java, which of the following blocks is always executed before the program ends, regardless of whether any exceptions are generated in the try block or not?
Athrow statement
Bthrows clause
Ccatch block
Dfinally block
Correct Answer: Option D
Note: G-March-2022
MCQ 139Types of Exceptions
In Java, which type of object must be there, to create an exception object and throw it explicitly otherwise compile error occurs?
Ajava.lang.Throwable
Bjava.util.Throwable
Cjava.Throwable
Djava.Throwable.Exception
Correct Answer: Option A
Note: G-March-2022
MCQ 140Types of Exceptions
In Java, which of the following can be used in a method declaration or constructor declaration to inform that the code within the constructor or method may throw an Exception?
Acatch block
Bfinally block
Cthrows clause
Dthrow statement
Correct Answer: Option D
Note: G-March-2022
MCQ 141Types of Exceptions
Which of the following blocks in Java, contains the code that we want to monitor for exceptions?
Acatch block
Btry block
Cfinally block
Dthrows clause
Correct Answer: Option B
Note: G-March-2022
MCQ 142Types of Exceptions
In Java, which code indicates that some problem occurred while executing the command?
AExit code: 0
BExit code: 1
CExit code: -1
DExit code: -2
Correct Answer: Option B
Note: G-March-2022
MCQ 143Run-time errors
When we try to divide an integer numbers by zero what will be the exception generated?
ANullPointerException
BNumberFormatException
CArithmeticException
DAll of the above
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 144The Finally blocks
In JAVA,the numbers of finally blocks followed in each try block is/are ?
A2
B3
C1
D5
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 145The Throw Clause
In java, which clause is used within the method or a constracter that may genterate an exception?
Athrow
Bthrows
Ccatch
Dfinally
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 146Run-time errors
WHICH EXCEPTION CLASS IS OBSERVED WHEN AN ATTEMPT TO ACCESS THE ARRAY ELEMENT WITH AN INDEX VALUE THAT IS OUTSIDE THE RANGE OF ARRAY IN JAVA
AARRY OUT OF BOX
BARRAY OUT OF INDEX
CARRAY BOUNDS
DNOT FOUND ARRAY
Correct Answer: Option B
Note: null
MCQ 147The Finally blocks
WHICH BLOCK IS GENERALLY USED TO CLEAN UP AT THE END OF EXECUTING A TRY BLOCK.
AFINALLY
BCATCH
CTRY
DTHROWS
Correct Answer: Option A
Note: null
MCQ 148Compile-time errors
IN JAVA IN WHICH CONDITION PROGRAM WILL GET A COMPILATION ERROR AND NOT BE ABLE TO CREATE ".CLASS" FILE.
ASYNTAX ERROR
BUSE OF UNDECLARED variable
CWRONG SPELING
DALL OF THESE
Correct Answer: Option D
Note: null
MCQ 149Types of Exceptions
Which type of errors are usually the mistakes of programmer?
ACompile-time errors
BRun-time errors
CExe time
DNone of above
Correct Answer: Option A
Note: null
MCQ 150Types of Exceptions
Which keywords are used in the presence of exception which represent block of statements?
Atry
Bcatch
Cfinally
DAll of these
Correct Answer: Option D
Note: null
MCQ 151Types of Exceptions
The syntax to throw an exception object is :
Athrow exception object;
Bthrow object;
Cthrew object
DTHROW
Correct Answer: Option A
Note: null
MCQ 152Types of Exceptions
Which exception classes are not provided by the Java for application specific exceptions?
ABuilt-in
Buser define
Cmethod
Dconstructor
Correct Answer: Option A
Note: null
MCQ 153Types of Exceptions
What type of an error occurs when there is a mismatch of bracket in Java program?
ACompile-time error
BRun-time error
CBoth A and B
DNone of the given
Correct Answer: Option A
Note: null
MCQ 154Types of Exceptions
Which exception class will be applied for the following Java coding? int a[] = new int[4]: a[13] = 99;
AArithmeticException
BArrayIndexOutOfBoundsException
CNullPointerException
DNumberFormatException
Correct Answer: Option B
Note: null
MCQ 155Types of Exceptions
In the field of computer science, which of the following indicates whether the command or program is executed successfully or not?
AReturn code
BExit code
CExit status
DB or C
Correct Answer: Option D
Note: null
MCQ 156Types of Exceptions
Which of the following code indicates that some problem has occurred in executing the program and the command is not successfully executed?
A0
B1
C2
D-1
Correct Answer: Option B
Note: null
MCQ 157Types of Exceptions
When is finally block used?
ABefore the program terminates
BAfter the program terminates
CIn the beginning of the program
DNone of the given
Correct Answer: Option A
Note: null
MCQ 158Types of Exceptions
The finally block is generally used to __________________ at the end of executing a try block.
Aclean up
Bcompile
Csummary
Dend program
Correct Answer: Option A
Note: null
MCQ 159Types of Exceptions
Which block must immediately follow the try block?
Acatch
Bthrow
Cfinally
DA or C
Correct Answer: Option D
Note: null
MCQ 160Types of Exceptions
Java uses keyword/s like ___________________ to write an exception handler.
Atry
Bcatch
Cfinally
DAll of the given
Correct Answer: Option D
Note: null
MCQ 161Types of Exceptions
Which code indicates that the command has been executed successfully?
ACode โ0โ
BExit 0
Ctext 0
DCode 1
Correct Answer: Option A
Note: S-March-2020
MCQ 162Types of Exceptions
Who created an exception object and was throwing it automatically?
AJVM
BJDK
CJRE
DUML
Correct Answer: Option A
Note: null
MCQ 163Types of Exceptions
Which method of the Scanner class helps in reading integer input from the console?
AnextInt()
BInt( )
Cnextint( )
DNEXTINT( )
Correct Answer: Option A
Note: null
MCQ 164Types of Exceptions
Which of the following exception occurs when an attempt is made to access a non-existing file?
ANullPointerException
BArithmeticException
CFileNotFoundException
DNoFileException
Correct Answer: Option C
Note: null
MCQ 165The try Block
Which type of code cotained by a try block?
ATo handle exceptions of particular type that were created in the associated try block
BRaise to one or mre exceptions
CExecuted before the program end
DAll of the above
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 166The catch block
Who can identify the type of exception that a Catch block is to deal?
AFile
Bvariable
Cparameter
Dfunctionย
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 167Compile-time errors
IN JAVA IN WHICH CONDITION PROGRAM WILL GET A COMPILATION ERROR AND NOT BE ABLE TO CREATE ".CLASS" FILE.
ASYNTAX ERROR
BUSE OF UNDECLARED variable
CWRONG SPELING
DALL OF THESE
Correct Answer: Option D
Note: null
MCQ 168The try Block
Which of the following elements are not included in try block?
Athe keyword try
Bthe keyword catch
Cthe curly bracket
Dstatements that might cause exceptions
Correct Answer: Option B
Note: G-March-2019
MCQ 169The catch block
In Java, which of the following block handles or takes appropriate action when an exception occurs?
Atry
Bcatch
Cthrows
Dhandles
Correct Answer: Option B
Note: G-March-2019
MCQ 170The Finally blocks
Which clause signifies that there is no catch block within the method that can handle the exception?
Athrows
Bif
Cloop
Darray
Correct Answer: Option A
Note: S-March-2020
MCQ 171Run-time errors
When we try to divide an integer numbers by zero what will be the exception generated?
ANullPointerException
BNumberFormatException
CArithmeticException
DAll of the above
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 172The Finally blocks
In JAVA,the numbers of finally blocks followed in each try block is/are ?
A2
B3
C1
D5
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 173The Finally blocks
Which block is always executed , regardless of whether or not expection are thrown during the execution of the associated try block?
Afinally
Bcatch
C(a) and (b) both
Dthrow
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 174Creating Custom Exception
Which class in Java is used to accept input from the Keyboard?
Ajava.keyboard
Bjava.util.Input
Cjava.SCANNER
Djava.util.Scanner
Correct Answer: Option D
Note: S-March-2020
MCQ 175The catch block
Who can identify the type of exception that a Catch block is to deal?