Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Sale notes online your Nr 1 Resource,for passing Exam at VCU

Beoordeling
-
Verkocht
-
Pagina's
11
Cijfer
A+
Geüpload op
02-08-2023
Geschreven in
2023/2024

I've written dozens of study guides for all my this material you'll be sure to pass your exams,Questions? Don't hesitate to send me messages

Instelling
Vak

Voorbeeld van de inhoud

EXCEL ENGINEERING COLLEGE
(Autonomous)
COMPUTER SCIENCE AND ENGINEERING
III Semester
20CS302 – OBJECT ORIENTED PROGRAMMING
Regulations 2020
Question Bank with Answer Key
UNIT – III (APPLETS, EXCEPTION HANDLING AND I/O)
PART- A
Q.No Questions
Define Exception.
1  A Java exception is an object that finds an exceptional condition occurs from a piece of code.
 An exception object is created and thrown to the method from the code where an exception is found.
Recall the purpose of exception handling mechanism.
 The main purpose of exception handling mechanism is used to detect and report an “exceptional
circumstance” so that necessary action can be taken. It performs the following tasks
 Find the problem(Hit the exception)
2
 Inform that an error occurred(throw the exception).
 Receive the error information(Catch the exception)
 Take corrective actions(Handle the exception)

What are the types of exceptions?
 There are two types of exceptions
3  Predefined Exceptions-The Exceptions which are predefined are calledpredefined exceptions
 Userdefined Exceptions- The Exceptions which are defined by the userare called userdefined exceptions

How the exception handling is managed?
 Java exception handling is managed via five keywords.
 try
4  catch
 throw
 throws and
 finally

Write down the general form of an exception-handling block.
 The general form of an exception-handling blocktry
{
// block of code to monitor for errors
}
catch (ExceptionType1 exOb)

5 {
// exception handler for ExceptionType1

}
catch (ExceptionType2 exOb)

{
// exception handler for ExceptionType2

, }
// ...
finally
{
// block of code to be executed after try block ends
}

List out the two subclasses under Throwable class.
 Throwable is a superclass for all exception types. Thus, Throwable is at topof the exception hierarchy.
 There are two subclasses under Throwable class.
6
 Exception
 Error

What is an Error?
 The another subclass is by Error, which defines exceptions that are notexpected to be caught under
normal circumstances by your program.
7  Exceptions of type Error are used by the Java run-time system to indicateerrors having to do with the run-
time environment, itself.
 Eg: Stack overflow is an example of such an error.

Identify the situation where we need to use multiple catchclauses.
 In some situation, more than one exception can occur by a single piece of code.
 To handle this situation, we can use two or more catch clauses, each catching a different type of exception.
8 When an exception is thrown, each catch block is executed in order, and the first one whose type matches
that exception is executed.
 After one catch block executes, the others are bypassed, and continues after the try/catch block.

Why we need to use nested try statements.
 The try statement can be nested. That is, a try statement can be inside the block of another try.
 Each time a try statement is entered, the context of that exception is pushed on the stack.
 If an inner try statement does not have a catch handler for a particular exception, the stack is unwound
9
and the next try statement’s catch handlers are inspected for a match.
 This continues until one of the catch statements succeeds, or until all of the nested try statements are
exhausted. If no catch statement matches, then the Java run-time system will handle the exception.

Write down the use of throws clause.
 Using throws clause, We can list the types of exceptions that a method might throw.
10  The exceptions which are thrown in a method might be using throws clause. If they are not, a compile-time
error will result.

Give the use of finally clause.
 Finally creates a block of code that is to be executed after a try/catch block has completed its execution.
 The finally block will execute if an exception is thrown or not thrown.
11
 The finally clause is optional.
 Each try block requires either one catch or a finally clause

Define Unchecked Exception.
 These are the exceptions that are not checked at compiled time.
12  In C++, all exceptions are unchecked, so it is not forced by the compiler to either handle or specify the
exception.
 It is up to the programmers to be civilized, and specify or catch the exceptions.

Gekoppeld boek

Geschreven voor

Vak

Documentinformatie

Geüpload op
2 augustus 2023
Aantal pagina's
11
Geschreven in
2023/2024
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

€11,35
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
vengatedits

Maak kennis met de verkoper

Seller avatar
vengatedits Excel Engineering College
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
2 jaar
Aantal volgers
0
Documenten
19
Laatst verkocht
-
Sale notes online your Nr 1 Resource,for passing Exam at VCU

I've written dozens of study guides for all my this material you'll be sure to pass your exams,Questions? Don't hesitate to send me messages

0,0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen