2.3 Flashcards
What is a robust program?
A robust program is one that can handle errors and unexpected inputs gracefully without crashing.
True or False: Robust programs are designed to handle only valid user inputs.
False
What is input validation?
Input validation is the process of ensuring that user input is correct and meets specified criteria before it is processed.
Fill in the blank: A program should provide __________ to users when an error occurs.
meaningful feedback
What are the two main types of errors that can occur in programs?
Syntax errors and runtime errors.
What is exception handling?
Exception handling is a programming construct that allows a program to respond to exceptional conditions (errors) during execution.
Multiple Choice: Which of the following is NOT a method of error handling? A) Try-Catch B) Input Validation C) Debugging D) Exception Handling
C) Debugging
What does ‘defensive programming’ mean?
Defensive programming is a design philosophy that ensures a program continues to function under unforeseen circumstances.
True or False: Comments in code improve the robustness of a program.
True
What role does testing play in producing robust programs?
Testing helps identify and fix bugs before the program is deployed to users.
Fill in the blank: Robust programs often include __________ to ensure that they can recover from errors.
redundancy
What is a user-friendly error message?
A user-friendly error message is a clear, concise message that explains what went wrong and how the user can correct it.
Multiple Choice: Which of the following is a benefit of producing robust programs? A) More bugs B) Higher maintenance costs C) Increased user satisfaction D) Slower performance
C) Increased user satisfaction
What is the purpose of logging in robust programs?
Logging helps track program behavior and errors for debugging and monitoring purposes.
True or False: All programming languages have built-in support for exception handling.
False
What does ‘graceful degradation’ refer to in programming?
Graceful degradation refers to a program’s ability to maintain functionality even when some components fail.
Fill in the blank: Robust programs often use __________ to manage memory efficiently.
garbage collection
What is a boundary case in testing?
A boundary case is a test case that checks the limits of input values to ensure the program behaves as expected.
Multiple Choice: Which of the following is an example of input validation? A) Checking if a number is within a specific range B) Writing comments C) Using exception handling D) None of the above
A) Checking if a number is within a specific range
What is the difference between syntax errors and runtime errors?
Syntax errors occur during code compilation, while runtime errors occur during program execution.
True or False: Robust programs can never fail.
False
What is the significance of code reviews in producing robust programs?
Code reviews help identify potential issues and improve code quality before deployment.
Fill in the blank: A robust program should be __________ to accommodate future changes.
maintainable
What is the role of documentation in robust programming?
Documentation provides clear guidelines and explanations for using and maintaining the program.