My humble beginning, 9 years ago
  • Image Transcription: Test Question



    [A programming test question. Code for an answer is scratched out in pen. In the text of the question, the words "blue and white" have a box drawn around them in pen as a highlighting measure.]

    5. (20 points) Write the code to create a checkerboard. The board is blue and white and containing 64 squares. Each square is 10 pixels in length. The top-left square is positioned at 0, 0. (Hint: You can fill one large square as the background, and place the smaller squares on top of it.)

    [An example black-and-white checkerboard is depicted. It is annotated with the coordinates of the corners, as well as with the dimensions of the first square. The answer has some parts crossed out.]

    g.~~file~~fillRect(0,0,80,80);

    ~~for(x=0;x<=80;x+=20)~~
    ~~    g.fillRect(x,~~

    g.drawRect(10,0,10,10);
    g.drawRect(30,0,10,10);
    g.drawRect(50,0,10,10);
    g.drawRect(70,0,10,10);
    g.drawRect(0,10,10,10);
    g.drawRect(20,10,10,10);
    g.drawRect(40,10,10,10);
    g.drawRect(60,10,10,10);
    g.drawRect(10,20,10,10);
    g.drawRect[30,20,10,10);
    g.drawRect(50,20,10,10);
    g.drawRect(70,20,10,10);
    g.drawRect(0,30,10,10);
    g.drawRect(20,30,10,10);
    g.drawRect(40,30,10,10);
    g.drawRect(60,30,10,10);
    g.drawRect(10,40,10,10);
    g.drawRect(30,40,10,10);
    g.drawRect(50,40,10,10);
    g.drawRect[70,40,10,10);
    g.drawRect(0,50,10,10);
    g.drawRect(20,50,10,10);
    g.drawRect(40,50,10,10);
    g.drawRect(60,50,10 10);

    [By this point, having run out of room to add a new line below their previous code on the page, the test-taker has drawn an arrow indicating that flow continues in a different column. Accompanying this code is some feedback written in colored ink by someone besides the test-taker, which will be indicated below in bold.]

    g.drawRect(10,60,10,10);
    g.drawRect(30,60,10,10);
    g.drawRectL50,60,10,10);
    g.drawRect(70,60,10,10);
    g.drawRect(0,70,10,10);
    g.drawRect(20,70,10,10);
    g.drawRect(40,70,10,10);
    g.drawRect(60,20,10,10);

    Use for loops!



    ^^I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
    1
    reply