Exception handling

Exception handling

University

15 Qs

quiz-placeholder

Similar activities

Web Designing Quiz-1

Web Designing Quiz-1

University

20 Qs

Micro:bit

Micro:bit

4th Grade - University

12 Qs

Scratch

Scratch

KG - Professional Development

10 Qs

Technology 2021

Technology 2021

University

10 Qs

Control Structures  C#

Control Structures C#

University

20 Qs

FOP - CHAPTER 6

FOP - CHAPTER 6

University

10 Qs

Subprograms and ADT

Subprograms and ADT

University

16 Qs

CS 11:QUIZ#2 (Basic Computer Programming)

CS 11:QUIZ#2 (Basic Computer Programming)

University

20 Qs

Exception handling

Exception handling

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

roop lal

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

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?