Home

Test 1 Guide

You will see some questions like the following. The test is on paper, closed-notes. The material covered is the coordinate system, colors, animation, and variables and types. Refer to the corresponding videos for those topics.

Coordinate system and shapes

Color

Some of these questions have a range of valid answers since, e.g., "dark red" is open to some interpretation.

Variables and types

What is the result of each of the following computations?

55 % 10
55 / 10
2.4 / 2.0
pow(2.0, 2.0)

If we have int x = 5, what is the value of x after each of these commands:

x--;
x--;
x *= 2;
x++;

If we have boolean q = true, what is the value of q after each of these commands:

q = false;
q = true || q;
q = !q;

Animation

Write the chunk of code (two functions) we will always include when we start writing a program.

Identify which of the two following chunks of code properly moves a triangle from the left of the screen to the right.

int x = 0;
int y = 200;

void setup()
{
    size(400, 400);
}

void draw()
{
    x--;
    background(0);
    triangle(x-50, y+50, x, y, x+50, y+50);
}
int x = 0;
int y = 200;

void setup()
{
    size(400, 400);
}

void draw()
{
    background(0);
    triangle(x-50, y+50, x, y, x+50, y+50);
    x = x + 5;
}

Complete this code so that the ellipse starts large but shrinks over time (its size is allowed to become negative).

int ________________;

void ________________
{
    size(400, 400);
}

void ________________
{
    background(255);
    ellipse(50, 100, ________________);
    
    __________________________;
}
CSE 1211 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.