Graphics & Coordinates
Variables & User Input
Math & Operators
Functions & Mouse Events
Computer Science & AP Pseudocode
100

What command puts a newly created circle onto the graphics canvas?

`add(circle);`


100

Write a valid JavaScript statement to store 32 books in a variable named `bookCount`.



`var bookCount = 32;`


100

What is the result of `17 % 5` in JavaScript?



2, the remainder after division.


100

What is a function in programming?



A named, reusable block of code that performs a task.



100

Which is a computer: a smartphone, a smart thermostat, or a car's computer system?



All three.



200

A canvas is 400 pixels wide and 300 pixels tall. What are the coordinates of its center?



(200, 150)


200

Which naming style is best for a JavaScript variable representing a student's grade: `student grade`, `studentGrade`, or `student-grade`?


`studentGrade` 


200

A game score is 6. The program calculates `score * score + score`. What is the result?



42

200

What is the name for a function passed to an event handler to run when an event occurs?



A callback function.

200

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.

300

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.


300

You need the user to enter a whole number for the number of tickets. Should you use `readLine()` or `readInt()`?


`readInt()`.

300

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.


300

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);`.

300

In AP pseudocode, what does the assignment arrow `←` do?



Stores the value on the right in the variable on the left.

400

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.


400

The user enters `Ava` and then `Chen`. If you concatenate the two strings without adding a space, what is printed?


`AvaChen`.


400

Evaluate `5 * 4 + 12 / 3` using operator precedence.



24


400

A click handler receives an event object `e`. Which expressions retrieve the mouse's x- and y-coordinates?


`e.getX()` and `e.getY()`.

400

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


500

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.


500

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`.


500

In AP pseudocode, `a ← 23`, `b ← 6`, and `c ← a MOD b`. What is `c`?


5. MOD returns the remainder.


500

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.

500

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.