CS 1401, Quiz #6

Date: Tuesday, February 27, 2007
Name: ____________________________________________________________
Class section (9:00 am or 10:30 am): _______________________________

1. For each of the following topics, write "yes" or "no" depending on whether this topic is covered in Chapter 6, the chapter that you were supposed to read before the class:

while loops

2-dimensional arrays

Graphical User Interface

object oriented design

2. Write a code that uses a for-loop to add the squares of all the integers from 0 to a given number n. Do not worry about reading this number or printing the results, assume that the number is there.







3. Write a similar code, but using the while loop.









4. For extra credit: Explain the difference between while- and for-loops. When is it better to use while loops and when for loops?