Home

Test 1

Submit your answers on Blackboard in the usual way. You can upload multiple files at once.

Question 1

Write your answers in a separate text file or Word doc.

  • What type should be used to hold the value 0.01?
  • What type should be used to hold the value “csci111”?
  • What type should be used to hold the value true?
  • What type is the key built-in variable?
  • What type is the width built-in variable?
  • Explain what 57 % 10 is calculating, in a word or two.
  • Rewrite x *= 41; in an equivalent but different way (not using +=).
  • Write a boolean expression that is true only when x is greater or equal to both y and z (all float values).
  • Write a boolean expression that is true only when n (an integer) is a multiple of 3.

Question 2

Recreate the program shown in the video. The window size is 400x400. The program should loop like this forever.

Question 3

Recreate the program shown in the video. When the r key is pressed, the box turns red; when the g key is pressed, the box turns green; and when the b key is pressed, the box turns blue. The box starts black. The window size is 400x400. The exact size and placement of the rectangle are not important, so long as it is visible.

Question 4

Recreate this program. The ellipse follows the mouse. Whenever the mouse button (left or right) is pressed, the ellipse is filled with black; otherwise it is filled with white. It should have a visible stroke. The window size is 400x400. The exact size of the ellipse is not important, so long as it is visible.

Question 5

Recreate this program. This is a variant of question 2. You can reuse your code from question 2. The circle grows and then shrinks, forever. The window size is 400x400.

CSCI 111 material by Joshua Eckroth is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.