Exception Handling

Exception Handling

University

53 Qs

quiz-placeholder

Similar activities

Java Language Quiz

Java Language Quiz

University

50 Qs

JavaScript-ITELECTIVE

JavaScript-ITELECTIVE

University

50 Qs

Orientation  Quiz

Orientation Quiz

University - Professional Development

50 Qs

Quiz JavaScript

Quiz JavaScript

University

51 Qs

ITC 112 - Topic 2 Quiz

ITC 112 - Topic 2 Quiz

University

50 Qs

2EB Quiz 04 Dec 2024

2EB Quiz 04 Dec 2024

University

50 Qs

Java Unit 1 MCQ Test

Java Unit 1 MCQ Test

University

50 Qs

Programming Test 1

Programming Test 1

University

51 Qs

Exception Handling

Exception Handling

Assessment

Quiz

Computers

University

Hard

Created by

SAKTHI IT-HICET

Used 11+ times

FREE Resource

53 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

When does Exceptions in Java arises in code sequence?

Run Time

Compilation Time

Can Occur Any Time

None of the mentioned

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

try

finally

thrown

catch

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Predict the output of following Java program

class Main {

public static void main(String args[]) {

try {

throw 10;

}

catch(int e) {

System.out.println("Got the Exception " + e);

}

}

}

Got the Exception 10

Got the Exception 0

Compiler Error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class Test extends Exception { }

class Main {

public static void main(String args[]) {

try {

throw new Test();

}

catch(Test t) {

System.out.println("Got the Test Exception");

}

finally {

System.out.println("Inside finally block ");

}

}

}

Got the Test Exception

Inside finally block

Got the Test Exception

Inside finally block

Compiler Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output of following Java program?

class Main {

public static void main(String args[]) {

int x = 0;

int y = 10;

int z = y/x;

}

}

Compiler Error

Compiles and runs fine

Compiles fine but throws ArithmeticException exception

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

class Test

{

public static void main (String[] args)

{

try

{

int a = 0;

System.out.println ("a = " + a);

int b = 20 / a;

System.out.println ("b = " + b);

}

catch(ArithmeticException e)

{

System.out.println ("Divide by zero error");

}

finally

{

System.out.println ("inside the finally block");

}

}

}

Compile error

Divide by zero error

a = 0

Divide by zero error

inside the finally block

a = 0

inside the finally block

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is a super class of all errors and exceptions in the Java language?

RunTimeExceptions

Throwable

Catchable

None of the above

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?