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


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

unittest

pytest

doctest

all of the above


4. Which command is used to run a single test case in Python?

python -m unittest test_case.py

python -m unittest discover

python -m unittest test_case.TestClass.test_method

python -m unittest test_case.TestClass


5. What is a regression test?

A test that verifies the entire system

A test that verifies a single function or module

A test that verifies changes made to the code do not cause existing functionality to break

A test that verifies the database


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


7. What is a debugger in Python?

A tool used to test user interfaces

A tool used to analyze code performance

A tool used to verify database connections

A tool used to find and fix errors in code


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


9. What is the purpose of a code coverage tool in Python testing?

To measure the amount of code that is executed during testing

To generate test data for use in testing

To identify and fix errors in code

To simulate user interactions with a system


10. What is a mutation test in Python testing?

A test that introduces deliberate errors into the code to measure the effectiveness of tests

A test that simulates user interactions with a system

A test that verifies that code is functioning as expected

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