Python Testing and Debugging
Python Testing and Debugging - Important Points
11. | What is a trace in Python debugging? |
---|
A. A log of program execution
B. A message displayed to the user
C. A report on code coverage
D. A mock object used in testing
View Answer Discuss Work SpaceAnswer: option a
Explanation:
12. | Which method is used to raise an exception in Python? |
---|
A. raise Exception("Error message")
B. assert Exception("Error message")
C. print Exception("Error message")
D. throw Exception("Error message")
View Answer Discuss Work SpaceAnswer: option a
Explanation:
13. | What is the purpose of the try-except block in Python? |
---|
A. To catch errors and handle them gracefully
B. To output messages to the user
C. To verify database connections
D. To test user interface interactions
View Answer Discuss Work SpaceAnswer: option a
Explanation:
14. | What is the purpose of the finally block in Python? |
---|
A. To catch errors and handle them gracefully
B. To output messages to the user
C. To verify database connections
D. To ensure code is executed regardless of whether an exception is raised
View Answer Discuss Work SpaceAnswer: option d
Explanation:
15. | Which module is used for debugging in Python? |
---|
A. pdb
B. unittest
C. logging
D. cProfile
View Answer Discuss Work SpaceAnswer: option a
Explanation: