Last updated on 3/4/20
Debug Your Java Applications Quiz
- Identify key debugging methodologies, tools, and vocabulary
A quiz that helps you question your knowledge about bugs, why they exist, and how you should respond to them.
Here is some output from a spell checker designed for the following requirement, "It should display spelling errors in a sentence." It is run against the sentence "quick brown fox jmps over the lsazy dog."%java SpellCheckerApp "quick brown fox jmps over the lsazy dog"Spelling errors found:- jmps (Did you mean jumps?)- lsazy (No alternatives)- dog (Did you mean dig?)Exiting program before completing due to:Exception in thread "main" java.lang.IllegalStateException: No match foundat java.util.regex.Matcher.group(Matcher.java:485)at java.util.regex.Matcher.group(Matcher.java:445)at com.openclassrooms.spelling.SpellChecker.check(SpellChecker.java:33)at SpellCheckerApp.main(SpellCheckerApp.java:14)
Based on the above, which of the following would be failures for this program?Careful, there are several correct answers.
Not highlighting poor grammar used in this sentence.
Showing an exception to the user.
Not finding alternatives for the misspelled "lazy."
Mistakenly classifying "dog" as a spelling error.
The program crashing before completion.
Which of the following represent a fault?Careful, there are several correct answers.
A calculator displaying an incorrect result 20% of the time.
A temporary variable rounding to 2 decimal places when it should round to 5.
A typo in the title of a report.
An IOException displayed to a user when a file can't be opened.
Correctly displaying the result of an operation to a user.
Imagine that you're a developer for an online streaming service. You've just received a piece of work telling you that the playlist recommendations software you released earlier in the day have been pulled out of production because it was only recommending "The Sound of Music" to all users. 🏔
Assuming that you didn't do this intentionally, which of the following represents the application of the scientific method for investigating this bug?
Open up the bit of code where you know the bug is, edit the file, recompile, ship it to product, and try it out.
Reproduce the bug in a controlled fashion, investigate, and formulate a theory as to its cause, then test it before fixing the issue.
Rewrite the code to make it more readable and testable, build it right, and release it.
Make lots of little fixes and try them out until something sticks!
Acquire a commercial license for a cloud-based recommendations engine and integrate it.