102.Throw and throws

102.Throw and throws

Professional Development

20 Qs

quiz-placeholder

Similar activities

JavaDemo1

JavaDemo1

Professional Development

15 Qs

SLG IPC144 Week 11

SLG IPC144 Week 11

Professional Development

15 Qs

PCED-Python Functions and Exceptions Quiz

PCED-Python Functions and Exceptions Quiz

Professional Development

20 Qs

Java Chapter 11 Review Questions

Java Chapter 11 Review Questions

Professional Development

24 Qs

WCF Training Test II

WCF Training Test II

Professional Development

25 Qs

OOP Quiz for Level 2 Undergraduates

OOP Quiz for Level 2 Undergraduates

Professional Development

20 Qs

Java Fundamentals

Java Fundamentals

Professional Development

20 Qs

Exception handling (Intro)

Exception handling (Intro)

Professional Development

23 Qs

102.Throw and throws

102.Throw and throws

Assessment

Quiz

Computers

Professional Development

Hard

Created by

ANIL KUMAR

FREE Resource

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
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?