The Temptation Island Test

  1. You and your mate are going to Temptation Island.  What do you take with you?
    1. Swim wear
    2. Pepper spray
    3. Phone card to call mommy
    4. Peanut butter
  2. How many times does the loop below draw a line?
    int i = 1;
    while (i < 10) {
         g.drawLine(i, 100, i+10, 100);
         i++;
    }



  3. How many times does the loop below draw a line?
    int i = 1;
    while (i > 99) {
          g.drawLine(i,100,i+10,100);
          i=99;
    }
  4. How many times does the loop below draw a line?
    for(i = 0; i < 10; i--) {
        g.drawLine(i, 100,l i+10, 100);
    }
  5. How many times does the loop below draw a line?
    int i = 1;
    while (i < 10) {
        g.drawLine(i, 100, i+10; 100);
        i = 1-i;
    }


  6. How many times does the loop below draw a line?
    int i = 1;
    while (i < 10) {
        g.drawLine(i, 100, i+10; 100);
        i = i * 2;
    }


  7. You are making a program to help decide if your mate is the one for you.  In this program, you click on yes/no buttons to answer various questions, and at the end you discover if you should move on, or keep the one you're with.  The program works perfectly.  But late at night one of the producers of the show removes the line 'repaint()' from the method 'mousePressed(mouseEvent me)'.  When you go to run the program the next morning, what do you notice
    1. Everything works fine
    2. The program won't compile
    3. The program fails as it begins to run
    4. The program dies half-way through running
    5. All the colors are wrong, but everything else is OK
    6. The program seems to ignore your mouse clicks
    7. The producer needs a better hobby
    8. None of the above.  

  8. Suppose you see the code below in a Java file.  What should the file be named?
    public MateCheck() {
        int loveHim = 0;
        int angerFactor = 0.7;
        addMouseListener(this);
    }


  9. What does the following code draw.  Make me a picture here --->
    public void paint(Graphics g) {
        g.setColor(Color.red);
        g.fillRect(10,10,100,100);
        g.setColor(Color.blue);
        g.fillRect(110,110,100,100);
    }


  10. Which corner has the location (0,0)?
    1. Upper left
    2. Upper right
    3. Lower left
    4. Lower right
    5. Middle
    6. Some other place

  11. What type should 3.1415 be?
    1. int
    2. double
    3. String
    4. Graphic
    5. MouseEvent
    6. Acky-Breaky-Heart

  12. Write me a program that draws a triangle to the screen.  You get
  13. Points Task
    1 Draws a triangle
    1 Has a method named drawTriangle that is uses to draw a triangle
    1 Uses a loop to draw many triangles in a column (not a row)
    1 Uses two loops to fill the screen with triangles
  14. Write me a program that draws a square on the screen
  15. Points Task
    1 Draws a square
    1 The program tells you where you clicked (x,y coordinates)
    2 The square alternates color on alternate clicks