menu

Python Testing and Debugging


1. What is a trace in Python debugging?

A log of program execution

A message displayed to the user

A report on code coverage

A mock object used in testing


2. What is code coverage in Python testing?

The percentage of code that is executed during testing

The amount of time it takes to run a test suite

The number of test cases that are run during testing

The number of bugs that are found during testing


3.

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


4. What is unit testing in Python?

Testing individual units or components of code in isolation

Testing the entire program as a whole

Testing user interface interactions

Testing database connections


5. Which module in Python provides support for integration testing?

unittest

pytest

selenium

all of the above


6. Which method is used to raise an exception in Python?

raise Exception("Error message")

assert Exception("Error message")

print Exception("Error message")

throw Exception("Error message")


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

unittest.mock

pytest-mock

mockito

all of the above


8. Which tool in Python can be used for profiling and optimizing code performance?

cProfile

timeit

memory_profiler

all of the above


9. What is a syntax 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 divides by zero


10. Which tool in Python can be used for static code analysis?

PyLint

Flake8

Bandit

all of the above