Workshop

The Workshop is designed to help you anticipate possible questions, review what you've learned, and get you thinking about how to put your knowledge into practice. The answers to the quiz are in Appendix A, “Answers to Quizzes/Exercises.”

Quiz

1:What type of error prevents C# from compiling and running code?
2:What is the name of a runtime error: an error that usually occurs as a result of attempting to process inappropriate data?
3:What character is used to denote a single line comment?
4:To halt execution at a specific statement in code, you set a what?
5:Explain the yellow arrow and red circles that can appear in the gray area in the code editor.
6:What IDE window would you use to poll the contents of a variable in Break mode?
7:True or False: You must always specify a catch section in a try structure.

Exercises

  1. In the code example that sets lngAnswer to the result of a division expression, change lngAnswer from a long to a single (call it sngAnswer). Next, remove the if statement that tests the contents of the text box before performing the division. Do you get the same exceptions that you did when the variable was a long? Why or why not?

  2. Rewrite the code that sets lngAnswer to the result of a division expression so that the code is wrapped in a try structure. Remove the if statements that perform data validation, and create two catch sections—one for each of the possible exceptions that may be thrown.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.34.161