Imagine you are working on enhancement for a social network Website. Determine a
ID: 3712092 • Letter: I
Question
Imagine you are working on enhancement for a social network Website. Determine at least two (2) types of errors that may occur and could be caught by try / catch blocks. Include one (1) example of such errors to support your response.
Based on the example that you have provided from Part I of this discussion, explain the importance of catching the error, as opposed to letting the user experience the error. As the programmer, decide the next step that you would take in order to best handle this situation after catching the error. Provide a rationale to support your response
Explanation / Answer
For example, a program will crash if it tries to use an array element A[i], when i is not within the declared range of indices for the array A. A robust program must anticipate the possibility of a bad index and guard against it. This could be done with an if statement:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.