102.Throw and throws

102.Throw and throws

Professional Development

20 Qs

quiz-placeholder

Similar activities

PYTHON ::04

PYTHON ::04

University - Professional Development

17 Qs

python basic

python basic

Professional Development

21 Qs

JDBC_Objective_Exam_2

JDBC_Objective_Exam_2

Professional Development

15 Qs

Chapter1

Chapter1

Professional Development

20 Qs

Salesforce Daily Quiz

Salesforce Daily Quiz

Professional Development

24 Qs

Javaquiz

Javaquiz

Professional Development

15 Qs

CloudBinary_Basic-Shell-scripting

CloudBinary_Basic-Shell-scripting

Professional Development

15 Qs

Java Quiz on Module 1 & 2

Java Quiz on Module 1 & 2

Professional Development

21 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?