CBSE Class 12 Computer Science Exception Handling In Java MCQs

CBSE Class 12 Computer Science Exception Handling In Java MCQs Set A with answers available in Pdf for free download. The MCQ Questions for Class 12 Computer Science with answers have been prepared as per the latest syllabus, NCERT books and examination pattern suggested in Standard 12 by CBSE, NCERT and KVS. Multiple Choice Questions are an important part of exams for Grade 12 Computer Science and if practiced properly can help you to get higher marks. Refer to more Chapter-wise MCQs for NCERT Class 12 Computer Science and also download more latest study material for all subjects

Exception Handling In Java Class 12 Computer Science MCQ

Class 12 Computer Science students should refer to the following multiple-choice questions with answers for Exception Handling In Java in standard 12. These MCQ questions with answers for Grade 12 Computer Science will come in exams and help you to score good marks

Exception Handling In Java MCQ Questions with Answers

Question: It is usually understood that a compiled program is error free and will always______successfully.

  • a) Complete
  • b) Execute
  • c) Perform
  • d) Accomplish

Answer: Execute


Question: In few cases a compiled program can_______while it its executing.

  • a) Terminate
  • b) Finish
  • c) Dismiss
  • d) Discharge

Answer: Terminate


Question: The_______in a program results in an abnormal execution and it may lead to abnormal termination of the program.

  • a) Exception
  • b) Error
  • c) Message
  • d) Mistake

Answer: Exception


Question: An is an indication of a problem thatc occurs during a program's execution.

  • a) Exception
  • b) Inaccuracy
  • c) Error
  • d) E-fault

Answer: Exception


Question: An exception usually signals an_______

  • a) Exception
  • b) Inaccuracy
  • c) Error
  • d) E-fault

Answer: Error


Question: Although exceptions occur infrequently, one has to be careful in handling such cases while writing the_______

  • a) Program
  • b) Message
  • c) Data
  • d) Code

Answer: Code


Question: ________handling allows a program to continue executing as if no problem had been encountered or it may notify the user of the problem before terminating in an uncontrolled manner.

  • a) Data
  • b) Program
  • c) Error
  • d) Exception

Answer: Exception


Question: There are few standard______available in Java, a technique to guarantee that a particular I block of code will always be executed, even if I exceptions are present in our program.

  • a) Data info
  • b) Programs
  • c) Errors
  • d) Exceptions

Answer: Exceptions


Question: In Java, all kinds of error conditions are called________

  • a) Methods
  • b) Programs
  • c) Errors
  • d) Exceptions

Answer: Exceptions


Question: Errors can be broadly classified into_______categories.

  • a) Four
  • b) Three
  • c) Two
  • d) Five

Answer: Two

 

Question: ________is a type of error produced in java programs.

  • a) Compile-time errors
  • b) Run-time errors
  • c) Both (A) and (B)
  • d) None of these

Answer: Both (A) and (B)


Question: A________is used to convert source code into object code.

  • a) Compiler
  • b) Interpreter
  • c) Translator
  • d) Decoder

Answer: Compiler


Question: A compiler is used to convert_______code into object code.

  • a) Home
  • b) Source
  • c) Beginning
  • d) Program

Answer: Source


Question: If there is a syntax error in the program, a compilation error is displayed and______file is not created.

  • a) .Source
  • b) .Dat
  • c) .Class
  • d) .Obj

Answer: .Class


Question: Examples of some common syntax errors are missing like a________

  • a) Semicolon
  • b) Use of undeclared variable
  • c) Wrong spellings of identifier or keyword
  • d) All of these

Answer: All of these


Question: The Java_______suggests in an output, the type of error, along with the line number where the error has occurred.

  • a) Compiler
  • b) Interpreter
  • c) Translator
  • d) Decoder

Answer: Compiler


Question: Compile-time_____are usually the mistake of a programmer and it does not allow the program to compile unless they are solved.

  • a) Methods
  • b) Programs
  • c) Errors
  • d) Exceptions

Answer: Errors


Question: In the field of Computer Science, "Exit code" or "Exit status" indicates whether the command or a______executed successfully or not.

  • a) Data type
  • b) Program
  • c) error
  • d) Method

Answer: Program


Question: Code_______indicates that the command executed successfully.

  • a) 1
  • b) -1
  • c) 0.0
  • d) 0

Answer: 0


Question: Code_______indicates that some problem occurred while executing the command.

  • a) 1
  • b) -1
  • c) 0.0
  • d) 0

Answer: 1


Question: If there are no syntax errors in the source code then the program will compile successfully and will get a_______file.

  • a) .source
  • b) .dat
  • c) .class
  • d) .obj

Answer: .class


Question: The array "_______ citylist [ ] = {"Ahmedabad", "Baroda", "Rajkot", "Surat"};" contains name of four different cities.

  • a) String
  • b) Int
  • c) Long
  • d) Boolean

Answer: String


Question: For each type of exception, there are corresponding______classes in Java.

  • a) Programs
  • b) Exceptions
  • c) Java.lang
  • d) Java.io

Answer: Exceptions


Question: The________contains a hierarchy of classes dealing with various exceptions.

  • a) Java.lang package
  • b) Java.io package
  • c) Both (A) and (B)
  • d) None of these

Answer: Both (A) and (B)


Question: An attempt to access the array element with an index value that is outside the range of array uses_______Exception class.

  • a) Array lndex Out Of Bounds Exception
  • b) Arithmetic Exception
  • c) File Not Found Exception
  • d) All of these

Answer: Array lndex Out Of Bounds Exception


Question: An attempt to divide any number by 0 uses_______Exception class.

  • a) Array lndex Out Of Bounds Exception
  • b) Arithmetic Exception
  • c) File Not Found Exception
  • d) All of these

Answer: Arithmetic Exception


Question: An attempt to divide any number by 0 uses______Exception class.

  • a) Array lndex Out Of Bounds Exception
  • b) Arithmetic Exception
  • c) File Not Found Exception
  • d) All of these

Answer: File Not Found Exception


Question: An attempt to use null in a case where an object is required uses_____Exception class.

  • a) PrinterlOException
  • b) NullPointerException
  • c) NumberFormatException
  • d) None of these

Answer: NullPointerException


Question: An attempt to convert string to a number type uses_______Exception class.

  • a) PrinterlOException
  • b) NullPointerException
  • c) NumberFormatException
  • d) None of these

Answer: NumberFormatException


Question: An I/O error has occurred while printing uses .......... Exception class.

  • a) Printer lO Exception
  • b) Null Pointer Exception
  • c) Number Format Exception
  • d) None of these

Answer: Printer lO Exception

 

Question: The following code will result in Exception. int numerator = 15; int denominator = 0; answer; answer = numerator / denominator;

  • a) Array lndex Out Of Bounds Exception
  • b) Arithmetic Exception
  • c) File Not Found Exception
  • d) All of these

Answer: Arithmetic Exception


Question: What is the full form of JVM ?

  • a) Java Virtual Mechanism
  • b) Java Virtual Method
  • c) Java Virtual Machine
  • d) Java Virtual Manner

Answer: Java Virtual Machine


Question: An______is an error condition.

  • a) Allowance
  • b) Exclusion
  • c) Error
  • d) Exception

Answer: Exception


Question: ________handling is an object-oriented technique for managing errors.

  • a) Allowance
  • b) Exclusion
  • c) Error
  • d) Exception

Answer: Exception


Question: While performing exception handling, one has to try to ensure that the program does not______abruptly nor does it generate unexpected output.

  • a) Terminate
  • b) Finish
  • c) Dismiss
  • d) Discharge

Answer: Terminate


Question: Java uses keywords like_______to write an exception handler.

  • a) Try
  • b) Catch
  • c) Finally
  • d) All of these

Answer: All of these


Question: The keywords______are used in the presence of exceptions, these keywords represent block of statements.

  • a) Try
  • b) Catch
  • c) Finally
  • d) All of these

Answer: All of these


Question: A______contains the code that may give rise to one or more exceptions.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Try block


Question: A________contains the code that is intended to handle exceptions of a particular type that were created in the associated try block.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Catch block


Question: A_______is always executed before the program ends, regardless of whether any exceptions are generated in the try block or not.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Finally block

 

Question: The______statement contains a block of statements within the braces.

  • a) Try
  • b) Catch
  • c) Finally
  • d) None of these

Answer: Try


Question: A______block may give rise to one or more exceptions.

  • a) Try
  • b) Catch
  • c) Finally
  • d) None of these

Answer: Try


Question: The code between a try block creates a.......... exception.

  • a) Double
  • b) Single
  • c) Triple
  • d) None of these

Answer: Single


Question: The_______must immediately follow the try block.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Catch block


Question: _______contains the code that is to be created to handle an exception.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Catch block


Question: The______is an exception handler.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Catch block


Question: For a______try block there can be one or more catch blocks.

  • a) Single
  • b) Double
  • c) Tirple
  • d) None of these

Answer: Single


Question: A catch block consists of the keyword catch followed by a single______

  • a) Operator
  • b) Method
  • c) Block
  • d) Parameter

Answer: Parameter


Question: The catch code to handle exception has to be written between_________

  • a) Codes
  • b) Blocks
  • c) Parentheses
  • d) Parameters

Answer: Parentheses


Question: The_______identifies the type of exception that the block is to deal with.

  • a) Operator
  • b) Method
  • c) Block
  • d) Parameter

Answer: Parameter


Question: Java supports______types of exceptions

  • a) Various
  • b) Single
  • c) Multiple
  • d) Some

Answer: Various


Question: Any program which tries to access array element by specifying index position that is outside the range leads to an_______

  • a) Illegal message
  • b) Exclusion
  • c) Error
  • d) Exception

Answer: Exception


Question: When above kind of exception occurs, an object of type is created and is thrown.

  • a) Array lndex Out Of Bounds Exception
  • b) Arithmetic Exception
  • c) File Not Found Exception
  • d) All of these

Answer: Array lndex Out Of Bounds Exception


Question: A corresponding_______handles the above exception and does not allow the program to terminate unexpectedly.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Catch block


Question: The catch block contains a______to object "eobj" which is created and thrown by the try block.

  • a) Space
  • b) Cell
  • c) Memory
  • d) Reference

Answer: Reference


Question: In a single program_______exceptions can occur.

  • a) Various
  • b) Single
  • c) Multiple
  • d) Some

Answer: Multiple


Question: If a particular file has to be uploaded to a remote computer, it may lead to_______distinct exceptions.

  • a) One
  • b) Two
  • c) Three
  • d) Four

Answer: Two


Question: If a particular file has to be uploaded to a remote computer, an exception may occur if the file is not present in the_______

  • a) Computer
  • b) Network
  • c) Internet
  • d) System

Answer: Computer


Question: If a particular file has to be uploaded to a remote computer, another exception may occur if the computer is not connected to the________

  • a) Computer
  • b) Network
  • c) Internet
  • d) System

Answer: Network


Question: There is a provision in Java to support______exceptions.

  • a) Various
  • b) Single
  • c) Multiple
  • d) Some

Answer: Multiple

 

Question: The code that generates exception should be written within the______

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Try block


Question: There can be multiple________to handle each type of exception separately.

  • a) Try blocks
  • b) Catch blocks
  • c) Finally blocks
  • d) All of these

Answer: Catch blocks


Question: The last______can handle any type of exception.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) None of these

Answer: Catch block


Question: The catch block, must be the last block when there are multiple catch blocks.

  • a) First
  • b) Second
  • c) Third
  • d) Default

Answer: Default


Question: While writing the program, the order of the specific catch blocks does not matter but the______block has to be placed at the end of all catch blocks.

  • a) First
  • b) Second
  • c) Third
  • d) Default

Answer: Default


Question: _______try blocks can be nested together, but care must be taken to write a corresponding catch block for each try block.

  • a) Various
  • b) Single
  • c) Multiple
  • d) Some

Answer: Multiple


Question: The_______is generally used to clean up the end of executing a try block.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Finally block


Question: A________is used when the programmer wants to be sure that some particular code is to be run, no matter what exceptions are thrown within the associated try block.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Finally block


Question: A________is always executed, regardless of whether or not exceptions are thrown during the execution of the associated try block.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Finally block


Question: A______is widely used if a file needs to be closed or a critical resource is to be released at the completion of the program.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Finally block

 

Question: Each try block must always be followed by at least________that is either a catch block or a finally block.

  • a) One block
  • b) Two blocks
  • c) Three blocks
  • d) None of these

Answer: One block


Question: However, in the presence of______the program executes the statements within the finally block before it gets terminated.

  • a) Try block
  • b) Catch block
  • c) Finally block
  • d) All of these

Answer: Finally block


Question: A________is associated with a particular try block and it must be located immediately following any catch blocks for the corresponding try block.

  • a) Finally block
  • b) Catch block
  • c) Try block
  • d) None of these

Answer: Finally block


Question: If there are no______then the finally block can be positioned immediately after the try block.

  • a) Try blocks
  • b) Catch blocks
  • c) Finally blocks
  • d) None of these

Answer: Catch blocks


Question: If the finally block or catch blocks are not positioned correctly, then the program will not

  • a) Compile
  • b) Interpret
  • c) Translate
  • d) Decode

Answer: Compile


Question: The_______keyword is used to explicitly throw an Exception object.

  • a) Throws
  • b) Throws
  • c) Throw
  • d) Try

Answer: Throw


Question: For example, an object of______was created when one tries to perform a divide by zero operation.

  • a) Array lndex Out Of Bounds Exception
  • b) Arithmetic Exception
  • c) File Not Found Exception
  • d) None of these

Answer: Arithmetic Exception


Question: Java does provide mechanism to create an______object and throw it explicitly.

  • a) Illusion
  • b) Exclusion
  • c) Error
  • d) Exception

Answer: Exception


Question: The object that one throws, must be of type of java.lang________, otherwise a compile error occurs.

  • a) Throwable
  • b) Throws
  • c) Throw
  • d) Throws

Answer: Throwable


Question: The syntax to throw an exception object is

  • a) Throw exception_object;
  • b) Throws exception_object;
  • c) Throws exception_object
  • d) Throw object;

Answer: Throw exception_object;


Question: When a_______statement is encountered, a search for matching catch block begins.

  • a) Throwable
  • b) Throws
  • c) throw
  • d) Throws

Answer: throw


Question: Any subsequent statements in the_______are not executed.

  • a) Try block
  • b) Try or catch block
  • c) Catch block
  • d) Try or finally block

Answer: Try or catch block


Question: There are______alternative approaches to handle, when an exception occurs in a method or a constructor.

  • a) One
  • b) Two
  • c) Three
  • d) Four

Answer: Two


Question: A_______clause can be used in a method declaration or constructor declaration to inform that the code within the constructor or method may throw an Exception.

  • a) Throwable
  • b) Throws
  • c) throw
  • d) throws

Answer: throws


Question: When a______or a method that can throw exceptions is written to its caller, it is useful to document that fact.

  • a) Constructor
  • b) Variable
  • c) Operator
  • d) Compiler

Answer: Constructor


Question: The________keyword is used with the declaration of method.

  • a) Throwable
  • b) Throws
  • c) throw
  • d) throws

Answer: Throwable


Question: A_______can throw multiple exceptions.

  • a) Method
  • b) Variable
  • c) Operator
  • d) Compiler

Answer: Method


Question: Each type of______that a method can throw must be stated in the method header.

  • a) Declaration
  • b) Variable
  • c) Error
  • d) Exception

Answer: Exception


Question: _______allows creating own exception classes according to application-specific problems.

  • a) C ++
  • b) C
  • c) Java
  • d) PHP

Answer: Java


Question: _______does not provide built-in exception classes for application specific exceptions.

  • a) C ++
  • b) C
  • c) Java
  • d) PHP

Answer: Java

 

Question: User-defined exceptions can be created by creating a subclass of______class.

  • a) Declaration
  • b) Input
  • c) Method
  • d) Exception

Answer: Exception


Question: If the______accepts data from the keyboard, it is advisable to execute the program at command prompt.

  • a) Program
  • b) Application
  • c) User
  • d) Compiler

Answer: Program


Question: A good program must always handle_______rather than the program being terminated abruptly.

  • a) Declarations
  • b) Inputs
  • c) Methods
  • d) Exceptions

Answer: Exceptions


Question: Advantage of using exception-handling in Java programs is______

  • a) It allows maintaining normal flow of program. In the absence of exception handling, the flow of program is disturbed.
  • b) It allows writing separate error handling code from the normal code.
  • c) Error types can be grouped and differentiated within the program.
  • d) All of these

Answer: All of these


Question: Advantage of using exception-handling in Java programs is______

  • a) Assertions can be used to debug the program before deploying it to the clients.
  • b) It provides an easy mechanism to log various run-time errors while executing the program.
  • c) Both (A) and (B)
  • d) None of these

Answer: Both (A) and (B)


Question: Which of the following is the correct syntax in a user defined exception ?

  • a) Catch (InvalidMarksException eobj)
  • b) Catch(AritmeticException eobj)
  • c) Catch (ArraylndexOutOfBounds e)
  • d) All of these

Answer: Catch (InvalidMarksException eobj)

 

Question: A throws clause can be used in the following manner :

  • a) MethodJVfodifiers methodJVame (parameters) throws Exception list...{......// body of the method......}
  • b) MethodJVIodifiers return_type method_Name (parameters) throws Exception list... {...... / / body of the method......}
  • c) Return_type method_Name (parameters) throws Exception list...{...... // body of the method......}
  • d) None of these

Answer: MethodJVIodifiers return_type method_Name (parameters) throws Exception list... {...... / / body of the method......}


Question: A method header can be like_________

  • a) Perform Division throws Arithmetic Exception, Array lndex Out Of Bounds Exception { ...... // body of the method .... }
  • b) Perform Division() throws Arithmetic Exception, Array Index Out Of Bounds Exception
  • c) Perform Division O throws Arithmetic Exception! ... // body of the method .... }
  • d) Perform Division O throws Arithmetic Exception, Array Index Out Of Bounds Exception { ...... // body of the method .... }

Answer: Perform Division O throws Arithmetic Exception, Array Index Out Of Bounds Exception { ...... // body of the method .... }


Question: The statement "throw myobject;"_________

  • a) Throws the exception object implicitly
  • b) Throws the exception object explicitly
  • c) Throws the object implicitly
  • d) None of these

Answer: Throws the exception object explicitly


Question: Which of these keywords must be used to monitor for exceptions ?

  • a) Try
  • b) Finally
  • c) Throw
  • d) Catch

Answer: Try


Question: The finally block is executed when an exception is thrown, even if no catch matches it. Choose the correct option.

  • a) True
  • b) False
  • c) Can't say
  • d) None of these

Answer: True


Question: Exceptions can be caught or re-thrown to a calling method. Choose the correct option.

  • a) True
  • b) False
  • c) Can't say
  • d) None of these

Answer: True


Question: The throw keyword in a program are not executed. Choose the correct option.

  • a) True
  • b) False
  • c) Can't say
  • d) None of these

Answer: True


Question: Which of these keywords is not a part of exception handling ?

  • a) Try
  • b) Finally
  • c) Thrown
  • d) Catch

Answer: Thrown


Question: Which of the following is true about try/catch blocks in Java ? (I) All try/catch blocks must have a finally block. (II) A try/catch block is limited to two or less catch blocks. (III) Barring the Java virtual machine from exiting, the finally block will always be executed.

  • a) (I) and (III)
  • b) (I) only
  • c) (III) only
  • d) (I) and (II)

Answer: (I) and (III)


Question: What will be the output of the program ? public class Test { public static void main(String [ ] args) { try { return; } finally { System.out.println("Finally");} }

  • a) Finally
  • b) Compilation fails
  • c) The code runs with no output
  • d) An exception is thrown at run time

Answer: Finally


Question: The key words used with exception handling are

  • a) Generate, handled, conclude
  • b) Generate, catch, finally
  • c) Throw, catch, conclude
  • d) Try, catch, finally

Answer: Try, catch, finally


Question: What happen behind the code int a=50/0 ?

  • a) Object of exception class thrown
  • b) Error in Code
  • c) Error message
  • d) None of these

Answer: Object of exception class thrown


Question: When an array is accessed beyond the array size_________exception is thrown.

  • a) Array Element Out Of Limit
  • b) Array Index Out Of Bounds Exception
  • c) Array Index Out Of Bounds
  • d) Array Element Out Of Bounds

Answer: Array Index Out Of Bounds Exception


Question: What is the output of this program ? class exception_handling { public static void main(String args[ ]) try { int a, b; b = 0; a = 5 / b; System.out.print("A"); } catch (Arithmetic Exception e) { System.out.print("B"); } }

  • a) A
  • b) B
  • c) Compilation error
  • d) Run time error

Answer: B

Tags: 

 


Click for more Computer Science Study Material
Cascading Style Sheets and JavaScript
CBSE Class 12 Computer Science Cascading Style Sheets and JavaScript MCQs
Classes and Objects In Java
CBSE Class 12 Computer Science Classes and Objects In Java MCQs Set A
CBSE Class 12 Computer Science Classes and Objects In Java MCQs Set B
Creating HTML Forms Using KompoZer
CBSE Class 12 Computer Science Creating HTML Forms Using KompoZer MCQs Set A
CBSE Class 12 Computer Science Creating HTML Forms Using KompoZer MCQs Set B
Designing Simple Website Using Kompozer
CBSE Class 12 Computer Science Designing Simple Website Using Kompozer MCQs
Exception Handling In Java
CBSE Class 12 Computer Science Exception Handling In Java MCQs
File Handling
CBSE Class 12 Computer Science File Handling MCQs Set A
CBSE Class 12 Computer Science File Handling MCQs Set B
File System
CBSE Class 12 Computer Science File System MCQs Set A
CBSE Class 12 Computer Science File System MCQs Set B
Introduction To E Commerce
CBSE Class 12 Computer Science Introduction To E Commerce MCQs
Introduction To M Commerce
CBSE Class 12 Computer Science Introduction To M Commerce MCQs Set A
CBSE Class 12 Computer Science Introduction To M Commerce MCQs Set B
Java Basics
CBSE Class 12 Computer Science Java Basics MCQs Set A
CBSE Class 12 Computer Science Java Basics MCQs Set B
Object Oriented Concepts
CBSE Class 12 Computer Science Object Oriented Concepts MCQs
Publishing Documents Using Latex
CBSE Class 12 Computer Science Publishing Documents Using Latex MCQs Set A
CBSE Class 12 Computer Science Publishing Documents Using Latex MCQs Set B

Latest NCERT & CBSE News

Read the latest news and announcements from NCERT and CBSE below. Important updates relating to your studies which will help you to keep yourself updated with latest happenings in school level education. Keep yourself updated with all latest news and also read articles from teachers which will help you to improve your studies, increase motivation level and promote faster learning

CBSE Reading Challenge

The acquisition of 21st century competencies of communication, critical and creative thinking and the ability to locate, understand and reflect on various kinds of information has become more crucial for our learners. It is well accepted that Reading Literacy is not...

CBSE Class 10 Revised Syllabus

Last year CBSE had to reduce the syllabus because of the pandemic situation but it was not very effective because there were no examinations. This year to avoid any confusion and conflict, CBSE has decided to reduce the syllabus into term 1 and term 2. 50 percent of...

CBSE OMR Sheet Guidelines for Term 1

You are aware that the CBSE will be using OMR for the first time for assessment of both the Classes-X and XII in Term-I examinations. Hence, there is a need that all the students appearing in the Term-l examinations and the schools sponsoring these students should have...

×
Studies Today