102.Throw and throws

102.Throw and throws

Professional Development

20 Qs

quiz-placeholder

Similar activities

KMeans & AHC

KMeans & AHC

Professional Development

15 Qs

IHDL2_Midterm Quiz

IHDL2_Midterm Quiz

Professional Development

20 Qs

Pre Test Fundamental Kotlin

Pre Test Fundamental Kotlin

Professional Development

20 Qs

interfaces, final , inheritance

interfaces, final , inheritance

Professional Development

20 Qs

Ch.8 - Introducing Python

Ch.8 - Introducing Python

6th Grade - Professional Development

20 Qs

SQL Programming Revision

SQL Programming Revision

Professional Development

20 Qs

Refresh your basics - MISRA 2012

Refresh your basics - MISRA 2012

Professional Development

20 Qs

ROUND 3 TECCASINO

ROUND 3 TECCASINO

KG - Professional Development

15 Qs

102.Throw and throws

102.Throw and throws

Assessment

Quiz

Computers

Professional Development

Practice Problem

Hard

Created by

ANIL KUMAR

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Create a free account and access millions of resources

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?