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 data type would you use to hold currency values?

2:

Which data type can be used to hold any kind of data and essentially serves as a generic data type?

3:

What values does C# support for type bool?

4:

What can you create to eliminate magic numbers by defining a literal value in one place?

5:

What type of data element can you create in code that can have its value changed as many times as necessary?

6:

What are the first and last indexes of an array dimensioned using string_strMyArray[5] ?

7:

What word is given to describe the visibility of a constant or variable?

8:

In general, is it best to limit the scope of a variable or to use the widest scope possible?

Exercises

  1. Create a project with a text box, a button, and a label control. When the user clicks the button, move the contents of the text box to a variable, and then move the contents of the variable to the Text property of the label. (Hint: a string variable will do the trick.)

  2. Rewrite the following code so that a single array variable is used rather than two standard variables . (Hint: Do not use a multidimensional array.)

     string strFirstName; string strLastName ; strFirstName = "Allison"; strLastName = "Bermejo"; 

   
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