Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Full Stack Quiz 16

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of these keywords are used for the block to be examined for exceptions?

a)

try

b)

catch

c)

throw

d)

check

2.

Which of these keywords are used for generating an exception manually?

a)

try

b)

catch

c)

throw

d)

check

3.

Which of these statements is incorrect?

a)

try block need not to be followed by catch block

b)

try block can be followed by finally block instead of catch block

c)

try can be followed by both catch and finally block

d)

try need not to be followed by anything

4.

1. What is the use of try & catch?

a)

It allows us to manually handle the exception

b)

It allows to fix errors

c)

It prevents automatic terminating of the program in cases when an exception occurs

d)

All of the mentioned

5.

What will be the output of the following Java code?

class Output

{

public static void main(String args[])

{

try

{

int a = 0;

int b = 5;

int c = b / a;

System.out.print("Hello");

}

}

}

a)

Hello

b)

World

c)

HelloWOrld

d)

Compilation Error

6.

Which of these keywords are used for the block to handle the exceptions generated by try block?

a)

try

b)

catch

c)

throw

d)

check

7.

Where should you keep your Java code that helps to take action on the exceptions raised inside TRY block?

a)

One more TRY block

b)

CATCH block

c)

FINALLY block

d)

None of the above

8.

If an exception occurs, all the lines of Java code that is below it stops executing. State TRUE or FALSE. 

a)

FALSE

b)

TRUE

c)

-

9.

Java exceptions are handled by ____.

a)

Java Compiler

b)

Java Runtime

c)

-

10.

Can you add more than one CATCH block when handling exceptions in Java?

a)

YES

b)

NO

11.

Which are access modifiers below in Java?

a)

public

b)

private

c)

protected

d)

All the above

12.

Where do you keep the Java code that should be executed at all times even if an exception occurs?

a)

inside TRY block

b)

inside CATCH block

c)

inside FINALLY block

d)

All the above

13.

Choose the correct way of writing TRY CATCH FINALLY blocks in Java.

a)

try{} catch{} finally{}

b)

try{} finally{}

c)

try{} catch{}

d)

All the above

14.

How many extra TRY blocks may be present with an existing TRY block in Java?

a)

0

b)

1

c)

2

d)

3

15.

The CATCH block should always be accompanied by a ____ block in Java.

a)

TRY

b)

CATCH

c)

FINALLY

d)

None

16.

How many CATCH blocks may be present in try-catch-finally series of blocks in Java?

a)

1

b)

2

c)

3

d)

any number of catch blocks

17.

Which are the keywords used to handle exceptions in Java?

a)

TRY, CATCH

b)

FINALLY

c)

THROW, THROWS

d)

All the above

18.

Which is the super class in Java that bundles all classes to deal with exceptions and errors?

a)

Error

b)

Exception

c)

Throwable

d)

Throw

19.

What is an Unchecked Exception in Java?

a)

An exception that need not be handled

b)

An exception that may be declared without compiler error

c)

Exceptions which will ignored by the compiler for not catching or for throwing

d)

All the above

20.

A checked exception is the one that:

a)

Needs to be dealt with explicitly by the method either by using try-catch or by propagating the exception to the caller

b)

Need not have to be dealt with explicitly by the method.

c)

None of the above