Questions · Page 1 of 4

MCQ

🎯

Test yourself on this topic

50 questions · timed · auto-graded

MCQ 11 Mark
To read which input from the console the nextlnt0 method helps?
  • A
    Real
  • B
    Binary
  • integer
  • D
    Octal
Answer
Correct option: C.
integer
integer
View full question & answer
MCQ 21 Mark
The nextInt0 method is of which class?
  • A
    Input
  • Scanner
  • C
    Java
  • D
    Output
Answer
Correct option: B.
Scanner
Scanner
View full question & answer
MCQ 31 Mark
What is SciTE?
  • an editor
  • B
    An animation software
  • C
    a browser
  • D
    a graphics tool
Answer
Correct option: A.
an editor
an editor
View full question & answer
MCQ 41 Mark
Which types of exceptions can we create by creating a subclass of Exception class?
  • User-defined
  • B
    Library
  • C
    Method-Defined
  • D
    None of these
Answer
Correct option: A.
User-defined
User-defined
View full question & answer
MCQ 51 Mark
Which of the following can be in try statement?
  • A
    Minimum one catch block
  • B
    More than one catch block
  • C
    finally, block
  • a Or b Or c
Answer
Correct option: D.
a Or b Or c
a Or b Or c
View full question & answer
MCQ 61 Mark
A method that throws an uncaught, checked exception must include following clause in its declaration.
  • throws
  • B
    throw
  • C
    try
  • D
    All of these
Answer
Correct option: A.
throws
throws
View full question & answer
MCQ 71 Mark
Which statement is used to throw an exception?
  • A
    try
  • B
    catch
  • throw
  • D
    finally
Answer
Correct option: C.
throw
throw
View full question & answer
MCQ 81 Mark
Which of the following combination should be used to catch exceptions in a program?
  • A
    try, finally, catch
  • B
    catch, try
  • C
    finally, catch
  • try, catch, finally
Answer
Correct option: D.
try, catch, finally
try, catch, finally
View full question & answer
MCQ 91 Mark
Which of the following is an advantage of Exception-handling?
  • 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
    The flow of program is not disturbed.
  • D
    All of these
Answer
Correct option: A.
Assertions can be used to debug the program before deploying it to the clients.
Assertions can be used to debug the program before deploying it to the clients.
View full question & answer
MCQ 101 Mark
Which of the following is an advantage of Exception-handling?
  • A
    It allows us to maintain normal flow of program.
  • B
    It allows writing separate error handling code from the normal code.
  • C
    Error types can be grouped and differentiated within the program.
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 111 Mark
Which of the following allows us to maintain normal flow of program?
  • Exception-handling
  • B
    Exception-compression
  • C
    Exception-cryptography
  • D
    None of these
Answer
Correct option: A.
Exception-handling
Exception-handling
View full question & answer
MCQ 121 Mark
What should always be handled rather than the program being terminated abruptly?
  • Exceptions
  • B
    Alert messages
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
Exceptions
Exceptions
View full question & answer
MCQ 131 Mark
From where can a simple program be executed which does not require user interaction?
  • From the SciTE editor
  • B
    From the command prompt
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
From the SciTE editor
From the SciTE editor
View full question & answer
MCQ 141 Mark
Form where it is advisable to execute the program if the program accepts data from the keyboard?
  • A
    From the SciTE editor
  • From the command prompt
  • C
    a and b both
  • D
    None of these
Answer
Correct option: B.
From the command prompt
From the command prompt
View full question & answer
MCQ 161 Mark
Which of the following ‘if’ statement is true to check whether the value of variable ‘m’ is from 0 to 100 or not?
  • if (m < 0 I l m> 100)
  • B
    if (m < 0) I l (m> 100)
  • C
    if (m < 0 I l > 100)
  • D
    if {m < 10 I l m> 100}
Answer
Correct option: A.
if (m < 0 I l m> 100)
if (m < 0 I l m> 100)
View full question & answer
MCQ 171 Mark
Which block is necessary to solve exceptions?
  • A
    try
  • B
    catch
  • C
    throw
  • throws
Answer
Correct option: D.
throws
throws
View full question & answer
MCQ 181 Mark
Which method of scanner class helps in reading integer input from the console?
  • Nextlnt0
  • B
    Getlnt0
  • C
    Int0
  • D
    Int0
Answer
Correct option: A.
Nextlnt0
Nextlnt0
View full question & answer
MCQ 191 Mark
Which class is used to accept input from the keyboard?
  • java.util.scanner
  • B
    java. Scanner
  • C
    java.util.keyboard
  • D
    java. Keyboard
Answer
Correct option: A.
java.util.scanner
java.util.scanner
View full question & answer
MCQ 201 Mark
By using which statement can the exceptions be thrown explicitly?
  • throws
  • B
    catch
  • C
    try
  • D
    finally
Answer
Correct option: A.
throws
throws
View full question & answer
MCQ 211 Mark
By creating which of the following we can create user-defined exceptions?
  • By creating a subclass of exception class.
  • B
    By creating method of exception class.
  • C
    By creating object of exception class.
  • D
    Not possible
Answer
Correct option: A.
By creating a subclass of exception class.
By creating a subclass of exception class.
View full question & answer
MCQ 221 Mark
Which of the following statements are true for Exceptions?
  • A
    Java allows to create our own exception classes according to application-specific problems.
  • B
    Java does not provide built-in exception classes for application specific exceptions.
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 231 Mark
Which of the following has own exception classes according to application-specific problems?
  • A
    If the user enters negative marks or the value is above 100.
  • B
    If the user enters value of standard rather than 1 to 12.
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 241 Mark
What is not needed if we are catching an exception type within the method?
  • To throw
  • B
    To try
  • C
    To catch
  • D
    All of these
Answer
Correct option: A.
To throw
To throw
View full question & answer
MCQ 251 Mark
What must be matching there if the method throws an Exception object?
  • catch handler
  • B
    try handler
  • C
    finally, handler
  • D
    throw handler
Answer
Correct option: A.
catch handler
catch handler
View full question & answer
MCQ 261 Mark
In which section of method each type of exception that a method can throw must be stated?
  • In header
  • B
    In footer
  • C
    In method
  • D
    Any where
Answer
Correct option: A.
In header
In header
View full question & answer
MCQ 281 Mark
Which clause signifies that there is no catch block within the method that can handle the exception?
  • throws
  • B
    throw
  • C
    try
  • D
    catch
Answer
Correct option: A.
throws
throws
View full question & answer
MCQ 291 Mark
Which 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?
  • throws
  • B
    throw
  • C
    try
  • D
    catch
Answer
Correct option: A.
throws
throws
View full question & answer
MCQ 301 Mark
With the declaration of which of the following is throws keyword used?
  • method
  • B
    object
  • C
    class
  • D
    None of these
Answer
Correct option: A.
method
method
View full question & answer
MCQ 311 Mark
Which approaches are there to handle exceptions created by a method?
  • $a$ Or $b$
  • B
    Invoking a method or constructor within a try block.
  • C
    Write a try $-$ catch block within the method or a constructor.
  • D
    None of these
Answer
Correct option: A.
$a$ Or $b$
$a$ Or $b$
View full question & answer
MCQ 321 Mark
How many approaches are available in Java to handle exceptions created by a method?
  • Two
  • B
    Three
  • C
    Four
  • D
    Five
Answer
Correct option: A.
Two
Two
View full question & answer
MCQ 331 Mark
Which block is available to handle the exception object thrown explicitly in Java?
  • catch
  • B
    finally
  • C
    thatch
  • D
    try
Answer
Correct option: A.
catch
catch
View full question & answer
MCQ 341 Mark
What search for matching begins when a throw statement is encountered?
  • catch
  • B
    try
  • C
    finally
  • D
    thatch
Answer
Correct option: A.
catch
catch
View full question & answer
MCQ 351 Mark
Write down syntax to throw an exception object.
  • A
    throw exception object.
  • B
    exception object throws;
  • throw exception object;
  • D
    None of these
Answer
Correct option: C.
throw exception object;
throw exception object;
View full question & answer
MCQ 361 Mark
What type of object that we throw must be?
  • A
    Object of Throw able class
  • B
    Object of any Throw able class’ sub-classes
  • a Or b
  • D
    None of these
Answer
Correct option: C.
a Or b
a Or b
View full question & answer
MCQ 371 Mark
What type of object that we throw must be?
  • java.lang.throwable
  • B
    java.exe
  • C
    java. Throw
  • D
    java.obj
Answer
Correct option: A.
java.lang.throwable
java.lang.throwable
View full question & answer
MCQ 381 Mark
which object is created when we try to perform divide by zero operation?
  • Arithmetic Exception
  • B
    Math Exception
  • C
    Numeric Exception
  • D
    Error Exception
Answer
Correct option: A.
Arithmetic Exception
Arithmetic Exception
View full question & answer
MCQ 391 Mark
Which of the following creates an exception object and throw it automatically, when throw statement is not used?
  • JOC
  • B
    JMV
  • C
    JVM
  • D
    JAV
Answer
Correct option: A.
JOC
JOC
View full question & answer
MCQ 401 Mark
Which keyword is used to explicitly throw an Exception object?
  • throw
  • B
    catch
  • C
    try
  • D
    throws
Answer
Correct option: A.
throw
throw
View full question & answer
MCQ 411 Mark
Which of the following blocks are if not positioned correctly, then the program will not compile?
  • A
    finally
  • B
    catch
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 421 Mark
Where is the “finally” block associated with a particular “try” block located?
  • Immediately following catch block
  • B
    Before main () method
  • C
    Before catch block
  • D
    None of these
Answer
Correct option: A.
Immediately following catch block
Immediately following catch block
View full question & answer
MCQ 431 Mark
With which of the following block a finally block is associated?
  • A
    catch
  • try
  • C
    a and b both
  • D
    None of these
Answer
Correct option: B.
try
try
View full question & answer
MCQ 441 Mark
By which of the following each try block is followed?
  • A
    catch
  • B
    finally
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 451 Mark
Which block must always be followed by each try block rather than a catch block?
  • finally
  • B
    throw
  • C
    throws
  • D
    a and b both
Answer
Correct option: A.
finally
finally
View full question & answer
MCQ 461 Mark
When is a finally block widely used at the completion of the program?
  • A
    If a file needs to be closed.
  • B
    If a critical resource is to be released.
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 471 Mark
Which block do we use when we want to be sure that some particular code is to be run, no matter what exceptions are thrown within the associated try block?
  • finally
  • B
    throws
  • C
    throw
  • D
    catch
Answer
Correct option: A.
finally
finally
View full question & answer
MCQ 481 Mark
Which block is generally used to clean up after executing a try block?
  • A
    throws
  • B
    throw
  • C
    catch
  • finally
Answer
Correct option: D.
finally
finally
View full question & answer
MCQ 491 Mark
Multiple try blocks can be nested.”- Specify this statement.
  • This statement is true.
  • B
    This statement is false.
  • C
    It depends on exceptions.
  • D
    None of these
Answer
Correct option: A.
This statement is true.
This statement is true.
View full question & answer
MCQ 501 Mark
What will be the order of the specific catch blocks rather than the default block while writing program?
  • In any order
  • B
    In sequence
  • C
    Cannot be determined
  • D
    None of these
Answer
Correct option: A.
In any order
In any order
View full question & answer