Unit Testing

38 MCQs

MCQs

38 questions · 30 min · 38 marks

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

Sample questions

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

  1. Question 1

    Unit testing is:

    • ATesting the entire application
    • BTesting individual components or functions
    • CTesting the user interface
    • DTesting database connections
    Show answer

    Answer: B

    Unit testing checks individual parts of a program.

  2. Question 2

    The Python module used for unit testing is:

    • Anumpy
    • Bmatplotlib
    • Cunittest
    • Dos
    Show answer

    Answer: C

    unittest is the built-in module for unit testing.

  3. Question 3

    The main purpose of using testing tools like unittest and pytest is to:

    • AIncrease program size
    • BVerify code works correctly
    • CDesign layouts
    • DCompile programs
    Show answer

    Answer: B

    These tools verify that code behaves as expected.

  4. Question 4

    Unit tests help catch errors:

    • AEarly in development
    • BAfter release
    • CAfter deployment
    • DWhen users report them
    Show answer

    Answer: A

    Unit tests catch errors early.

  5. Question 5

    Unit testing makes debugging:

    • ALonger
    • BOptional
    • CHarder
    • DEasier
    Show answer

    Answer: D

    Catching errors early makes debugging easier.

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