Control Structure Quiz

1)How many items does the first loop print? ________________________________
2)What does the second loop print? _______________________________________
3)How many items does the "simple for loop" print? __________________________
4 and 5)Tell me everything that the "nested loops" print:
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
6) What values does 'a' have as the paint function is ending? ___________________
7) Must this program have an init() function? ________________________________
8) What is the most number of times that paint() can be called in this program? _____
9) What happens when the mouse is clicked()? ______________________________
class control extends java.applet.Applet {
 
    public boolean mouseDown(Event e, int x, int y) {
        x = y;
        return true;
    }
    public void paint(Graphics g) {
 
        // first loop
        int a = 10;
        int b = 5;
        boolean bool = true;
        while (a < 5 && b < 3 && bool) {
            g.printString("A = " + a, a, a);
            a++;
        }

        // second loop
        boolean bool2 = true;
        do {
            g.drawString("Inside do loop", 100, 200);
            bool2 = true;
        } while (bool2 == false);

        // the simple for loop
        int c;
        for(c = 0; c < 5; c++ ) {
            g.drawString("C = " +c, c*20, c*20);
        }

        // the nested loops
        inner = 0;
        outer = 0;
        while(outer < 2) {
            do { 
                int total = outer+inner;

                g.drawString("Outer plus Inner"+total, total*40, 10);
                inner++;
            } while (inner < 1);
            outer++;
        }
    }
}