Self-assessment quiz
Testing Quiz
---
primary_color: orange
secondary_color: lightgray
text_color: black
shuffle_questions: false
---
## What is the primary purpose of unit testing in software development?
---
shuffle_answers: true
---
- [ ] To test the entire application at once
- [x] To ensure that each individual component of the software functions correctly
- [ ] To test the user interface of the application
- [ ] To validate the performance of the software
## In the following Python function, what would be an appropriate unit test to ensure its correctness?
---
shuffle_answers: true
---
```python
def add(a: int, b: int) -> int:
return a + b
```
- [x] Test that checks if the function returns the correct sum of two positive numbers.
- [x] Test that verifies if the function handles negative numbers correctly.
- [ ] Test that checks if the function raises an exception when non-numeric values are passed.
- [ ] Test that ensures the function works with floating-point numbers.
## Writing tests after the code is developed is generally considered a best practice in software development.
- [ ] True
- [x] False
Documentation Quiz
---
primary_color: orange
secondary_color: lightgray
text_color: black
shuffle_questions: false
---
## What is the purpose of documentation comments in Python?
---
shuffle_answers: true
---
- [ ] To provide comments that are ignored by the interpreter
- [x] To document the code and generate external documentation using tools
- [ ] To add comments specifically for developers reading the code
- [ ] To specify the indentation level of the code block.
## In Python, how are single-line comments typically denoted?
---
shuffle_answers: true
---
- [ ] `// Comment`
- [ ] `"""Comment """`
- [ ] `/* Comment */`
- [x] `# Comment`
## What is the difference between single-line and multi-line comments in programming languages?
- [ ] Single-line comments are ignored by the compiler/interpreter, while multi-line comments are executed.
- [x] Single-line comments can only span one line, while multi-line comments can span multiple lines.
- [x] Single-line comments are typically used for code documentation, while multi-line comments are used for internal notes.
- [ ] There is no difference; both single-line and multi-line comments serve the same purpose.