Search Header Logo

102.Throw and throws

Authored by ANIL KUMAR

Computers

Professional Development

102.Throw and throws
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the purpose of the throw keyword in Java?

To catch exceptions
To declare exceptions
To create custom exceptions
To handle finally blocks

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How is the throws keyword used in Java?

To catch exceptions
To declare exceptions
To create custom exceptions
To handle finally blocks

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Can you use both throw and throws together in a method declaration?

Yes
No
Depends on the exception
Only for unchecked exceptions

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Explain the difference between the throw and throws keywords in Java.

Similar usage
Used for checked exceptions
Used for unchecked exceptions
Throw creates, throws declares

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

How does the throw keyword handle custom exceptions in Java?

It catches exceptions
It creates exceptions
It declares exceptions
It prevents exceptions

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

When should you use the throws keyword in a method signature?

When catching exceptions
When creating exceptions
When declaring exceptions
When handling finally blocks

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What happens if an exception thrown by a method is not caught or declared with throws?

It gets handled by default
It's ignored
Compiler error
It triggers finally block

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?