menu

Python Testing and Debugging


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

cProfile

timeit

memory_profiler

all of the above


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

PyLint

Flake8

Bandit

all of the above


3. 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


4. 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


5. Which module in Python provides support for logging?

logging

log

logger

all of the above


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

unittest.mock

pytest-mock

mockito

all of the above


7. What is a mock object in Python?

An object that simulates the behavior of a real object in a controlled way

An object that is used to bypass security measures in a program

An object that is used to test network connections

An object that is used to generate random data for testing


8. Which tool is used for profiling Python code?

cProfile

unittest

logging

pdb


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

unittest

pytest

selenium

all of the above


10.

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