Exceptions and Profiling

47 MCQs

MCQs

47 questions · 40 min · 47 marks

Want to try first? Take the free Computer Science test: Networks Basics

Sample questions

The first 5 of 47. Try each one, then tap to see the answer.

  1. Question 1

    Exception handling manages errors that occur:

    • AWhile the code is typed
    • BBefore the file is saved
    • CDuring program execution
    • DWhile Python installs
    Show answer

    Answer: C

    Exception handling deals with errors that arise while the program runs.

  2. Question 2

    Exception handling prevents a program from:

    • ACrashing
    • BUsing memory
    • CPrinting output
    • DAccepting input
    Show answer

    Answer: A

    Exception handling stops a program from crashing suddenly.

  3. Question 3

    The Python keyword pair used for exception handling is:

    • Atry-except
    • Btry-finally
    • Ctry-catch
    • Dhandle-throw
    Show answer

    Answer: A

    Python handles exceptions with try and except blocks.

  4. Question 4

    A program with exception handling can respond to unexpected situations:

    • ASilently
    • BRandomly
    • CSlowly
    • DGracefully
    Show answer

    Answer: D

    Exception handling lets a program respond gracefully.

  5. Question 5

    Exception handling improves reliability and:

    • ACompilation speed
    • BUser experience
    • CFile size
    • DScreen resolution
    Show answer

    Answer: B

    It improves reliability and user experience.

More tests in Code Testing and Debugging

Practise with a free account

Save your scores, see which chapters need work, and keep a notebook of every question you got wrong.

Create free account