Software Trivia Quiz Questions

25 Questions | Total Attempts: 737

SettingsSettingsSettings
Please wait...
Software Trivia Quiz Questions

If a software can be executed it is considered to be a functional system. However, there might be unprecedented events that inhibit execution, which is identified as exceptions. Every programmer has to have knowledge of the types of exceptions. Take the quiz below to see the extent of knowledge of exceptions and how you treat them.


Questions and Answers
  • 1. 
    An exception is:
    • A. 

      A problem a computer has during construction

    • B. 

      A problem that a program has during runtime

    • C. 

      Something that the computer does not understand

    • D. 

      The way a computer signals to the users that it is about to terminate

  • 2. 
    In many cases, handling an exception allows a program to automatically restart execution of the program from the beginning.
    • A. 

      True

    • B. 

      False

  • 3. 
    The base class for all exception classes is System.Exception.
    • A. 

      True

    • B. 

      False

  • 4. 
    Which of the following is not included in an exception's stack trace?
    • A. 

      A descriptive message for the exception.

    • B. 

      The method­call stack at the time the exception occurred.

    • C. 

      The name of the exception.

    • D. 

      Instructions on handling the exception.

  • 5. 
    Which of the following is false regarding the throw point of an exception?
    • A. 

      It specifies the point at which the exception must be handled.

    • B. 

      It's the initial point at which the exception occurs.

    • C. 

      It's specified as the top row of the method­call stack at the time the exception occurred.

    • D. 

      All of the above statements are true.

  • 6. 
    After an exception has occurred and a stack trace has been printed, the program may exit or continue executing, depending on the circumstances.
    • A. 

      True

    • B. 

      False

  • 7. 
    In the catch block below, what is e?catch ( DivideByZeroException e ){Console.WriteLine( e );} // end catch
    • A. 

      The type of the exception being caught

    • B. 

      The name of catch block's exception parameter

    • C. 

      A finally block

    • D. 

      An exception handler

  • 8. 
    A catch block that does not specify an exception type or an identifier _______.
    • A. 

      Is an error

    • B. 

      Cannot catch any exceptions

    • C. 

      Can catch any exceptions

    • D. 

      None of the above

  • 9. 
    Which of the following statements about try blocks is true?
    • A. 

      The try block must be followed by at least one catch block.

    • B. 

      The try block must be followed by a finally block.

    • C. 

      The try block should contain statements that may process an exception.

    • D. 

      The try block should contain statements that may throw an exception.

  • 10. 
    What's the difference between a try block and a try statement?
    • A. 

      There is no difference; the terms can be used interchangeably.

    • B. 

      A try statement refers to the block of code following the keyword try, while the try block refers to the try keyword and the block of code following this keyword.

    • C. 

      The try block refers to the keyword try followed by a block of code. The try block and its corresponding catch and/or finally clauses together form a try statement.

    • D. 

      The try statement refers to the keyword try followed by a block of code. The try statement and its corresponding catch and/or finally clauses together form a try block.

  • 11. 
    In order to display the error message generated by an exception, you use:
    • A. 

      The Message method of class Exception

    • B. 

      The Message property of class Exception

    • C. 

      The ErrorMessage method of class Exception

    • D. 

      The ErrorMessage property of class Exception

  • 12. 
    Exception handlers typically access objects in their try blocks to determine the causes of the exceptions.
    • A. 

      True

    • B. 

      False

  • 13. 
    User­created exceptions can be created by:
    • A. 

      Overriding the Error class.

    • B. 

      Overriding the Exception property.

    • C. 

      Extending class Exception.

    • D. 

      They cannot be created

  • 14. 
    A NullReferenceException is thrown when there's an attempt to use a reference that points to nothing.
    • A. 

      True

    • B. 

      False

  • 15. 
    There must be a catch clause for every expected exception type.
    • A. 

      True

    • B. 

      False

  • 16. 
    Which of the following statements is false?
    • A. 

      A finally block, if there is one, is placed after the last catch block.

    • B. 

      A finally block should release all resources acquired in the corresponding try block.

    • C. 

      The finally block and try block can appear in any order.

    • D. 

      A finally block is optional.

  • 17. 
    After a finally block has finished executing:
    • A. 

      Control proceeds to the first statement after the finally block.

    • B. 

      Control returns to the throw point.

    • C. 

      He app exits.

    • D. 

      Control proceeds to the first statement after the last catch block.

  • 18. 
    In order to tell the user what happened in an exception you must
    • A. 

      Pop the exception

    • B. 

      Toss the exception

    • C. 

      Access Exception properties

    • D. 

      Throw the exception

  • 19. 
    After the last catch block, the required finally block provides code that always executes regardless of whether or not an exception occurs.
    • A. 

      True

    • B. 

      False

  • 20. 
    The finally block is an ideal location for code that releases resources to prevent "resource leaks."
    • A. 

      True

    • B. 

      False

  • 21. 
    The finally block is executed only if no error was reached in the try block.
    • A. 

      True

    • B. 

      False

  • 22. 
    There can be no code in between try/catch/finally blocks.
    • A. 

      True

    • B. 

      False

  • 23. 
    Which of the following is not a property of Exception?
    • A. 

      HelpLink

    • B. 

      Source

    • C. 

      TargetSite

    • D. 

      PrintError

  • 24. 
    Stack unwinding is the process that attempts to locate an appropriate catch handler for an uncaught exception.
    • A. 

      True

    • B. 

      False

  • 25. 
    User­defined exceptions should be derived from the:
    • A. 

      ApplicationException class.

    • B. 

      ConsoleException class.

    • C. 

      Exception class.

    • D. 

      SystemException class.

Back to Top Back to top