runtime errors, keywords, Programming Essentials, quiz help

Anonymous
timer Asked: Jul 25th, 2016
account_balance_wallet $5

Question Description

Question 1

  1.  

    Exception handling allows our programs to:

    Deal with situations, except in certain conditions.

    Prevent our program from crashing unexpectedly.

    Recover lost data when a crash occurs.

    Prevent crashes, no matter what.

1 points  

Question 2

  1.  

    When a runtime error occurs inside of a try block:

    an exception object is created and thrown.

    an exception message is printed to the screen.

    It immediately triggers a specified function to activate.

    The operating system handles the error.

1 points  

Question 3

  1.  

    What keyword do we use to specify a block of code that will handle an exception?

    try:

    except:

    catch:

    throw:

1 points  

Question 4

  1.  

    Exception handling must be implemented from the beginning of a program’s design.

1 points  

Question 5

  1.  

    We can control what kind of exceptions are detected and handled by specifying a(n) _______ in the header of the except code block.

    data type

    an exception object type

    receiver function

    this is automatic.

1 points  

Question 6

  1.  

    We can specify an exception handler block that detects multiple specific exception types

1 points  

Question 7

  1.  

    If we do not specify the exception type in the except block header, then no exceptions will be handled.

1 points  

Question 8

  1.  

    In exception handling, you define your except blocks before the try block.

1 points  

Question 9

  1.  

    What is the output of the following code if the user typed the letter ‘C’, then hit the ‘Enter’ key:

    print("Type Control C or -1 to exit")

    number = 1

    while number != -1:

     try:

     number = int(input("Enter a number: "))

     print("You entered:", number)

     except ValueError:

     print("That was not a number.")

    You entered: C

    That was not a number.

    Error message.

    Nothing happens.


Tutor Answer

DrCS
School: UIUC

Q1) Prevent our program from crashing u...

flag Report DMCA
Review

Anonymous
Thank you! Reasonably priced given the quality not just of the tutors but the moderators too. They were helpful and accommodating given my needs.

Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors