Exception handling

Exception handling

University

15 Qs

quiz-placeholder

Similar activities

Exceptions + java

Exceptions + java

University

11 Qs

Exception Handling

Exception Handling

University

13 Qs

Java Quiz 4

Java Quiz 4

University

15 Qs

PHP & MySQL

PHP & MySQL

University

20 Qs

Java Programming

Java Programming

University

20 Qs

Exception handling -oracle plsql

Exception handling -oracle plsql

University

15 Qs

OOP Data Types

OOP Data Types

University

20 Qs

java quiz on exception handling

java quiz on exception handling

University

20 Qs

Exception handling

Exception handling

Assessment

Quiz

Computers

University

Medium

Created by

roop lal

Used 2+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to handle exceptions in C#?

catch

final

throw

error

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the finally block do in exception handling?

Executes only when an exception is thrown

Executes only if no exception is thrown

Executes always, regardless of whether an exception occurs or not

Skips execution if an exception is caught

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct order of a try-catch-finally block?

try-catch-finally

try-finally-catch

catch-try-finally

finally-catch-try

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the throw keyword do in C#?

Ignores the exception

Logs the exception

Rethrows the exception

Stops the program

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which class is the base class for all exceptions in C#?

Error

Exception

BaseException

SystemException

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the following code?

try {

int x = 5 / 0;

} catch (DivideByZeroException) {

Console.WriteLine("Divide by zero");

} finally {

Console.WriteLine("Finally block");

}

Runtime error

Divide by zero

Divide by zero
Finally block

Finally block only

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if an exception is thrown and not caught?

Program will continue execution

Program will crash

Exception will be logged

Exception will be ignored

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?