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:

Which decision construct should you use to evaluate a single expression to either true or false?

2:

Evaluating expressions to true or false for both types of decision constructs is accomplished using ________ logic.

3:

If you want code to execute when the expression of an if statement evaluates to false, include an ____ clause.

4:

Which decision construct should you use when evaluating the result of an expression that may equate to one of many possible values?

5:

Is it possible that more than one case statement may have its code execute?

6:

True or False: You can use goto to jump code execution to a different method.

7:

To use goto to jump execution to a new location in code, what must you create as a pointer to jump to?

Exercises

  1. Create a project that allows the user to enter text into a text box. Use an if construct to determine whether the text entered is Circle, Triangle, Square, or Pentagon, and display the number of sides the entered shape has. If the text doesn't match one of these shapes , let the users know that they must enter a shape.

  2. Rewrite the following code using only an if structure; the new code should not contain a goto.

     ... if (!blnAddToAge) goto SkipAddToAge; lngAge++; SkipAddToAge: ... 

   
Top


Sams Teach Yourself C# in 24 Hours
Sams Teach Yourself Visual Basic 2010 in 24 Hours Complete Starter Kit (Sams Teach Yourself -- Hours)
ISBN: 0672331136
EAN: 2147483647
Year: 2002
Pages: 253
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net