Workshop


Quiz

1.

True or False: You have to know the start and end values of a for loop at design time to use this type of loop.

2.

Is it possible to nest loops?

3.

What type of loop would you most likely need to create if you didn't have any idea how many times the loop would need to occur?

4.

If you evaluate the expression in a do...while on the while statement, is it possible that the code within the loop may never execute?

5.

What statement do you use to terminate a do...while without evaluating the expression on the do or while statements?

Answers

1.

False, you can use a variable to define the start or end values of a for loop.

2.

Yes, you can nest loopseven loops of different types.

3.

A do...while loop.

4.

No, the code will always execute at least once.

5.

You use a break statement.

Exercises

1.

Create a text box in your No Remainders project and let the user enter a number. Find the first 10 numbers that are evenly divisible by the number entered by the user.

2.

Use two for loops nested within each other to size a label in two dimensions. Have the outer loop change the Width property of the label from 1 to 100, and have the inner loop change the Height property from 1 to 100. Don't be surprised by the end resultit's rather odd.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

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