The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we help you to solve your academic and programming questions fast.
In eduladder you can Ask,Answer,Listen,Earn and Download Questions and Question papers.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
Apply or Post Jobs, Courses ,Internships and Volunteering opportunity. For FREE
See Our team
Wondering how we keep quality?
Got unsolved questions? Ask Questions


Asked On2017-05-20 10:40:20 by:scribed

Taged users:

Be first to like this question

Be first to dislike this question
Talk about this  Like  Dislike
View all qusetions

An exception can be defined as an unexpected—or at least unusual— condition that arises during program execution, and that cannot easily be handled in the local context. It may be detected automatically by the language implementation, or the program may raise it explicitly.

The most common exceptions are various sorts of run-time errors. To cope with such errors without an exception-handling mechanism, the programmer has basically three options, none of which is entirely satisfactory:

1. “Invent” a value that can be used by the caller when a real value could not be returned.

2. Return an explicit “status” value to the caller, who must inspect it after every call. The status may be written into an extra, explicit parameter, stored in a global variable, or encoded as otherwise invalid bit patterns of a function’s regular return value.

3. Pass a closure for an error-handling routine that the normal routine can call when it runs into trouble.

Defining Exceptions

 In many languages, including Clu, Ada, Modula-3, Python, Java, C#, and ML, most dynamic semantic errors result in exceptions, which the program can then catch.

 The programmer can also define additional, application-specific exceptions. Examples of predefined exceptions include arithmetic overflow, division by zero, end-of-file on input, subscript and subrange errors, and null pointer dereference.

 In Ada, exception is a built-in type; an exception is simply an object of this What is an exception? type: declare empty_queue : exception;

When control enters a protected block, the handler for that block is added to the head of the list. When an exception arises, either implicitly or as a result of a raise statement, the language run-time system pops the innermost handler off the list and calls it. The handler begins by checking to see if it matches the exception that occurred if not, it simply reraises it: 

if exception matches duplicate in set

. . .

else reraise exception

Exception Propagation

Syntax in other languages is similar. In C++:

Exception handler in C++

try { ... // protected block of code ... }

catch(end_of_file) { ... }

catch(io_error e) {

// handler for any io_error other than end_of_file



catch(...) {

// handler for any exception not previously named

// (in this case, the triple-dot ellipsis is a valid C++ token;

// it does not indicate missing code)


The handlers attached to a block of code are always examined in order; control is transferred to the first one that matches the exception. In Ada, a handler matches if it names the propagating exception or if it is a “catch-all” others clause.

Answerd on:2015-12-06 Answerd By:metaphor

Be first to like this answer

Be first to dislike this answer
Talk about this  Like  Dislike

You might like this video:Watch more here

Watch more videos from this user Here

Learn how to upload a video over here

Lets together make the web is a better place

We made eduladder by keeping the ideology of building a supermarket of all the educational material available under one roof. We are doing it with the help of individual contributors like you, interns and employees. So the resources you are looking for can be easily available and accessible also with the freedom of remix reuse and reshare our content under the terms of creative commons license with attribution required close.

You can also contribute to our vision of "Helping student to pass any exams" with these.
Answer a question: You can answer the questions not yet answered in eduladder.How to answer a question
Career: Work or do your internship with us.Work with us
Create a video: You can teach anything and everything each video should be less than five minutes should cover the idea less than five min.How to upload a video on eduladder