What command puts a newly created circle onto the graphics canvas?
`add(circle);`
Write a valid JavaScript statement to store 32 books in a variable named `bookCount`.
`var bookCount = 32;`
What is the result of `17 % 5` in JavaScript?
2, the remainder after division.
What is a function in programming?
A named, reusable block of code that performs a task.
Which is a computer: a smartphone, a smart thermostat, or a car's computer system?
All three.
A canvas is 400 pixels wide and 300 pixels tall. What are the coordinates of its center?
(200, 150)
Which naming style is best for a JavaScript variable representing a student's grade: `student grade`, `studentGrade`, or `student-grade`?
`studentGrade`
A game score is 6. The program calculates `score * score + score`. What is the result?
42
What is the name for a function passed to an event handler to run when an event occurs?
A callback function.
Which is higher-level code: binary machine instructions, assembly language, or a readable function call such as `move();`?
`move();` is the highest-level choice listed.
A circle has radius 25 and is positioned at (80, 120). What does the x-coordinate represent?
The x-coordinate of the circle's center.
You need the user to enter a whole number for the number of tickets. Should you use `readLine()` or `readInt()`?
`readInt()`.
A cyclist travels 12 kilometers in 30 minutes. What expression calculates the speed in kilometers per hour?
`12 / (30 / 60)`, which equals 24 km/h.
You want `drawStar` to run whenever the mouse is clicked. Should you pass `drawStar`, `drawStar()`, or `drawStar(e)` to `mouseClickMethod()`?
Pass `drawStar` without parentheses: `mouseClickMethod(drawStar);`.
In AP pseudocode, what does the assignment arrow `←` do?
Stores the value on the right in the variable on the left.
A circle's radius is 18. A user gives you its diameter instead. What calculation converts the diameter to the correct radius?
Divide the diameter by 2.
The user enters `Ava` and then `Chen`. If you concatenate the two strings without adding a space, what is printed?
`AvaChen`.
Evaluate `5 * 4 + 12 / 3` using operator precedence.
24
A click handler receives an event object `e`. Which expressions retrieve the mouse's x- and y-coordinates?
`e.getX()` and `e.getY()`.
In AP pseudocode, `DISPLAY("Hi")`, `DISPLAY("Sam")` displays each value with a trailing space and does not automatically start a new line. What is displayed?
`Hi Sam `, with a space after each displayed value and no automatic new line.Return to board
A circle is positioned at (radius, radius). If the radius is 35, what are its center coordinates, and why does it touch the top and left edges?
(35, 35). Its center is one radius away from each edge, so the circle's outer edge touches both.
Trace the assignments: `a = 7`, `b = 14`, `a = b`, `b = 9`. What are the final values of `a` and `b`?
`a` is 14; `b` is 9. Changing `b` later does not change `a`.
In AP pseudocode, `a ← 23`, `b ← 6`, and `c ← a MOD b`. What is `c`?
5. MOD returns the remainder.
A click handler creates a circle with radius 20 and positions it using `e.getX()` and `e.getY()`. What happens after three clicks at three different locations?
Three circles of radius 20 appear, one centered at each clicked location, assuming the handler adds each circle to the canvas.
Trace these AP pseudocode statements: `x ← 8`, `y ← 3`, `z ← x`, `x ← y`, `y ← z`. What are the final values of `x` and `y`?
`x` is 3; `y` is 8. The old value of `x` was copied into `z` before `x` changed.