Save
SEMESTER 01
PLATFORM DEV THEORY
Chapter 13: Exeptions
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Soeroe
Visit profile
Cards (23)
What is the main topic of Chapter 13?
Exceptions
in
programming
View source
Why might exceptional situations occur in a program?
Due to complex program
requirements
View source
How do programmers view exceptional situations?
As
exceptions
needing solutions
View source
What does C# provide for handling exceptions?
A complete exception
infrastructure
View source
Why do game developers advise against using exception handlers?
Because
exception handling
is slow
View source
What is the preferred behavior when exceptions occur in programs according to the text?
To
handle
exceptions gracefully
View source
What happens when a float is divided by zero?
It results in
Infinity
View source
What does the compiler do when it detects an int division by zero?
Flags it as an
error
View source
What exception is thrown when an int is divided by zero?
System.DivideByZeroException
View source
What does Visual Studio do when an exception occurs during execution?
Catches the exception and shows a
dialog
View source
What are the steps to catch an exception in C#?
Encapsulate code in a
try block
Match exceptions with
catch clauses
Execute the first matching catch clause
Execute
finally block
if present
View source
What is the purpose of a try block in exception handling?
To encapsulate code that may
throw exceptions
View source
What happens if no matching catch clause is found?
The
exception
is passed to the
calling method
View source
What must thrown exceptions contain?
Information
describing
the
exception
View source
What class do all exceptions in C# inherit from?
System.Exception
View source
What happens when an exception is thrown and not caught?
The
method
halts and passes the exception
View source
What is the role of a finally block in exception handling?
To execute code regardless of
exception occurrence
View source
How can finer selection of exceptions be achieved in C#?
By using when clauses in catch clauses
View source
What are the key components of exception handling in C#?
Try block
: encapsulates code that may throw exceptions
Catch clause
: handles specific exceptions
Finally block
: executes code after try/catch
Throwing exceptions
: indicates an error condition
View source
What is the difference between errors and exceptions in programming?
Errors
are
fatal
,
exceptions
are
manageable
View source
What happens to the execution of a method when an exception is thrown?
The method
halts
and passes the
exception
View source
Why is the order of catch clauses important?
Because the first matching clause is
executed
View source
Can custom exception classes be defined in C#?
Yes, they can inherit from
System.Exception
View source