levo

Exception Handling and Managing Input and Output

Types of error and how an exception is raised

  • 3 things to know
  • AS Unit 1

Overview

Syntax error, run-time error and logic error.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Distinguish between an error and an exception in Java's classification.

Key term

What is a syntax error?

Key term

What is a run-time error?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is a syntax error?

    Model answer

    A syntax error breaks the rules of the language, such as a missing semicolon or an unmatched bracket, and the compiler refuses to produce a program at all until the fault is corrected.

  2. 2

    What is a run-time error?

    Model answer

    A run-time error occurs while the program is executing, when it is asked to do something impossible such as dividing by zero or opening a file that is not there.

  3. 3

    What is a logic error?

    Model answer

    A logic error is code that compiles and runs without complaint but produces the wrong answer, because the instructions do not express what the programmer intended.

  4. 4

    Which of the three kinds of error cannot be dealt with by exception handling?

    Model answer

    A logic error cannot be trapped, because nothing appears wrong to the machine and the program produces an incorrect result rather than an error condition.

  5. 5

    What is an exception?

    Model answer

    An exception is an object created at the point a run-time fault occurs, carrying the type of the fault and information about where in the program it arose.

  6. 6

    What does it mean to throw an exception?

    Model answer

    Throwing an exception means abandoning the normal flow at the point of the fault and passing the exception object out to whatever code is prepared to deal with it.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A null is the of one.
absencepresencetype

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AA null means no value has been recorded.
BZero and an empty string are values.
CA null is the absence of a value.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

An error is the mistake a person made.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Exception Handling and Managing Input and Output, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.