CSCI 316: Quiz 12 - Exception and Event Handling
Sign in to Google
to save your progress.
Learn more
* Indicates required question
Email
*
Your email
Last Name
*
Your answer
First Name
*
Your answer
Student Id
*
Your answer
What is the primary purpose of exception handling in a programming language?
*
1 point
To simplify syntax analysis
To eliminate the need for type checking
To allow programs to intercept and respond to run-time errors
To improve execution speed
To replace conditional statements
An exception is best described as:
*
1 point
An unusual condition detected during program execution
A user-defined data type
A syntax error detected by the compiler
An event that occurs only at compile time
A hardware interrupt only
What does it mean when an exception is thrown?
*
1 point
Memory is deallocated
An abnormal condition is signaled
Control is transferred to an event handler
The program terminates immediately
A value is returned from a function
What is exception propagation?
*
1 point
Re-executing failed statements
Copying exceptions into global memory
Translating exceptions into error codes
Logging exceptions to disk
Passing exceptions up the call stack
In most languages, if an exception is not handled locally, it:
*
1 point
Is converted to a warning
Causes a compile-time error
Is retried automatically
Is propagated to the calling unit
Is ignored
Which construct is typically used to enclose code that may raise an exception?
*
1 point
try
while
switch
goto
if / else
In C++, which keyword is used to signal an exception?
*
1 point
signal
throw
error
raise
except
Which of the following is true about C++ exception handling?
*
1 point
It does not allow user-defined exceptions
It handles only hardware faults
It requires dynamic typing
It forbids stack unwinding
It supports polymorphic exception handling
Stack unwinding refers to:
*
1 point
Rolling back variable assignments
Releasing activation records during exception propagation
Saving the heap state
Reversing recursion
Optimizing recursive calls
Checked exceptions in Java are:
*
1 point
Ignored by the compiler
Limited to arithmetic errors
Required to be handled or declared
Used only for I/O
Detected only at run time
Unchecked exceptions in Java are those that:
*
1 point
Are syntax errors
Must be declared in a throws clause
Occur only in threads
Cannot be caught
Are subclasses of RuntimeException
Which Java block is always executed whether or not an exception occurs?
*
1 point
finally
catch
throws
default
try
What happens if a Java exception is thrown and no handler is found?
*
1 point
The exception becomes a warning
The program terminates after stack trace generation
It is ignored
Control returns to main silently
The program retries the operation
Python exceptions are typically signaled using which statement?
*
1 point
signal
error
throw
except
raise
Which feature distinguishes Python’s exception handling from Java’s?
*
1 point
Dynamic typing of exceptions
No finally clause
No propagation
Mandatory checked exceptions
No user-defined exceptions
Ruby exception handling most closely resembles that of:
*
1 point
Ada
Python
Java
Fortran
C
In Ruby, which keyword corresponds to Java’s catch?
*
1 point
finally
handle
except
rescue
when
What is a major advantage of language-level exception handling over error codes?
*
1 point
Faster execution
Separation of error handling from normal logic
Simpler syntax
Reduced memory usage
Elimination of debugging
A major criticism of exception handling is that it can:
*
1 point
Prevent concurrency
Prevent modularity
Break recursion
Reduce readability if overused
Eliminate type safety
Event handling is primarily associated with:
*
1 point
Compiler design
Database indexing
Numerical computation
File systems
User interfaces
An event is best described as:
*
1 point
A compile-time error
A syntax construct
A user or system action detected by a program
A predefined exception
A thread context switch
Event-driven programming typically relies on:
*
1 point
Polling loops only
Recursion exclusively
Callbacks or handlers
Static binding
Sequential execution
In Java, event handling is commonly implemented using:
*
1 point
Global variables
Listener interfaces
Coroutines
Exception handlers
Macros
Which Java package is central to GUI activity handling?
*
1 point
java.activity
java.awt.event
java.io
java.lang
java.util
In C#, event handling is based primarily on:
*
1 point
Delegates
Exception objects
Templates
Reflection only
Macros
A C# delegate is best described as:
*
1 point
A special thread
A data structure
A runtime process
An exception object
A type-safe function reference
A key difference between exceptions and events is that events:
*
1 point
require stack unwinding
are synchronous only
terminate program execution
are typically asynchronous notifications
always indicate errors
Which of the following is NOT a common design issue for event handling?
*
1 point
Event priority
Event dispatch mechanism
Handler registration
Garbage collection
Event source identification
Compared to exceptions, events are more often used to:
*
1 point
Detect type errors
Signal user actions
Manage recursion
Control memory allocation
Handle arithmetic faults
Both exception handling and event handling improve:
*
1 point
Memory locality
Compile-time optimization
Static binding
Execution speed
Reliability and responsiveness
A copy of your responses will be emailed to the address you provided.
Submit
Clear form
Never submit passwords through Google Forms.
reCAPTCHA
Privacy
Terms
This content is neither created nor endorsed by Google. -
Terms of Service
-
Privacy Policy
Does this form look suspicious?
Report
Forms
Help and feedback