menu

Python Testing and Debugging


1. Which module in Python provides support for unit testing?

unittest

pytest

doctest

all of the above


2. What is a breakpoint in Python?

A location in the code where the program stops running

A location in the code where the program starts running

A location in the code where the program outputs a message

A location in the code where the program skips a line


3. Which module in Python provides support for mocking and patching?

unittest.mock

pytest-mock

mockito

all of the above


4.

What is a unit test in Python?

A test that verifies the entire system

A test that verifies a single function or module

A test that verifies the user interface

A test that verifies the database


5. What is a logical error in Python?

An error that occurs when the code is not valid Python syntax

An error that occurs when the program runs out of memory

An error that occurs when the program encounters unexpected input

An error that occurs when the program produces incorrect output due to a flaw in the logic


6. What is the purpose of code coverage in Python testing?

To verify the user interface

To verify database connections

To measure how much of the code is being tested

To measure how much of the code is being used by the user


7. What is a regression test in Python testing?

A test that ensures that code changes have not introduced new errors

A test that measures the performance of a system under heavy loads

A test that simulates user interactions with a system

A test that verifies that code is functioning as expected


8. Which tool in Python can be used for load testing?

locust

pytest-benchmark

httperf

all of the above


9. What is a mock object in Python?

An object that simulates the behavior of a real object

An object that replaces a real object in a test

An object that verifies the behavior of a real object

An object that tests user interface interactions


10. What is a breakpoint in Python debugging?

A point in the code where execution is paused to allow for inspection

A point in the code where execution is terminated

A point in the code where a specific action is triggered

A point in the code where an error is expected to occur