Search Header Logo

Practice: Exception Handling

Authored by Wayground CTE

Information technology (IT)

9th Grade

Blooms Level: Remember covered

Practice: Exception Handling
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which keyword starts a block where code that might throw an error is placed?

Throw

Catch

Finally

Try

Answer explanation

The try block wraps risky code so errors can be caught. Catch handles errors after they are thrown, not before.

Tags

Blooms Level: Remember

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What value does the catch block receive as its parameter?

A numeric status code

An error object

A boolean flag value

A raw stack trace string

Answer explanation

Catch receives an Error object with properties like message and name. A stack trace string is just one property of that object, not the parameter itself.

Tags

Blooms Level: Remember

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

A developer needs cleanup code to run after a try block, even if catch also runs. Where does it go?

In the catch block

In the try block

In the finally block

In a throw statement

Answer explanation

Finally executes after try and catch complete, making it the right place for cleanup like closing files or resetting UI state.

Tags

Blooms Level: Apply

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which keyword raises a custom error from inside a function?

Raise

Error

Throw

Catch

Answer explanation

Throw signals an error and stops normal execution. Error is the constructor used with throw, not the keyword that raises it.

Tags

Blooms Level: Remember

5.

MULTIPLE SELECT QUESTION

2 mins • 2 pts

Which TWO statements about try-catch-finally are correct? (Select all that apply)

Try must be paired with catch, finally, or both

Errors thrown in try skip remaining try statements

Catch only runs when an error is thrown

Finally runs only when no error occurs

Throw can only appear inside a catch block

Answer explanation

Catch fires only on errors, and try requires at least one of catch or finally. Finally runs in both cases, and throw is allowed anywhere.

Tags

Blooms Level: Analyze

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What happens to code after a throw statement in the same try block?

It executes normally

It runs after finally

It is skipped entirely

It runs only if catch is absent

Answer explanation

Throw immediately exits the current block, so later statements in try are skipped. Control jumps to the matching catch block.

Tags

Blooms Level: Understand

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which try-catch-finally structure is syntactically valid in JavaScript?

Catch block without try

Try block without catch or finally

Finally block without try

Try block followed only by finally

Answer explanation

Try requires catch, finally, or both. A standalone catch or finally without try causes a syntax error.

Tags

Blooms Level: Remember

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?