java quiz on exception handling

java quiz on exception handling

University

20 Qs

quiz-placeholder

Similar activities

Python Quiz

Python Quiz

University

15 Qs

Algoritma Remedial RPL

Algoritma Remedial RPL

University

20 Qs

Arduino ม.2 และ ม.3 ฉบับที่ 2

Arduino ม.2 และ ม.3 ฉบับที่ 2

KG - Professional Development

20 Qs

Chapter 8 - Memory Management Strategies

Chapter 8 - Memory Management Strategies

University

15 Qs

GK Quiz

GK Quiz

University

15 Qs

Java Quiz 4

Java Quiz 4

University

15 Qs

Skill Competition Quiz 2024

Skill Competition Quiz 2024

10th Grade - University

20 Qs

SOFTWARE 7I

SOFTWARE 7I

7th Grade - University

20 Qs

java quiz on exception handling

java quiz on exception handling

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

Anupam Yadav

Used 270+ times

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 SELECT QUESTION

30 sec • 1 pt

Which of these keywords is not a part of exception handling?

try

finally

thrown

catch

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class Foo

{

public static void main(String[] args)

{

try

{

return;

}

finally

{

System.out.println( "Finally" );

}

}

}

Finally

Compilation fails.

The code runs with no output

An exception is thrown at runtime.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the program?

try

{

int x = 0;

int y = 5 / x;

}

catch (Exception e)

{

System.out.println("Exception");

}

catch (ArithmeticException ae)

{

System.out.println(" Arithmetic Exception");

}

System.out.println("finished");

finished

runtime error.

Compilation fails

Exception.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class X

{

public static void main(String [] args)

{

try

{

badMethod();

System.out.print("A");

}

catch (Exception ex)

{

System.out.print("B");

}

finally

{

System.out.print("C");

}

System.out.print("D");

}

public static void badMethod()

{

throw new Error(); /* Line 22 */

}

}

ABCD

Compilation fails.

C is printed before exiting with an error message.

BC is printed before exiting with an error message

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

public class X

{

public static void main(String [] args)

{

try

{

badMethod();

System.out.print("A");

}

catch (RuntimeException ex) /* Line 10 */

{

System.out.print("B");

}

catch (Exception ex1)

{

System.out.print("C");

}

finally

{

System.out.print("D");

}

System.out.print("E");

}

public static void badMethod()

{

throw new RuntimeException();

}

}

BD

BDE

BD

DE

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

java.lang.NullPointerException is a

Error

runtime exception

Compile time exception

None

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

FileNotFoundException

Is a subclass/extends IOException

Is a Compile time exception

Found in java.io package

All

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?