What does print(9 / 2) display in Python 3?
4.5
Which Python function displays a message and waits for a user to type a response?
`input()`.
What are the coordinates of the top-left corner of a CodeHS graphics canvas?
(0, 0).
What do we call a function passed to another function so it can be called later?
A callback function.
What is code?
Instructions written in a programming language for a computer to execute.Back to board
What is the value of 19 % 4?
3
Write a statement that stores the whole-number value entered for the number of siblings in an integer variable named `siblings`.
`siblings = int(input("How many siblings do you have? "))`.
A canvas is 500 pixels wide and 300 pixels tall. What is the center coordinate?
(250, 150).
What programming approach runs code in response to a mouse click or key press?
Event-driven programming.
Is a smart thermostat an example of a computing device? Explain briefly.
Yes. It processes information and can execute programmed instructions.
What does print(5 * 3 + 8 / 4) display?
17.0
What is printed by `first = "Mia"; last = "Park"; print(first + " " + last)` when each statement is on its own line?
`Mia Park`.
A program creates a circle with `ball = Circle(25)` and positions it with `ball.set_position(90, 60)`. What does (90, 60) represent?
The x- and y-coordinates of the circle's center.
You want `draw_square` to run on each click. Should you register `draw_square` or `draw_square()` as the callback?
Register `draw_square` without parentheses.
In AP pseudocode, what does `←` mean?
Assignment: store the value on the right in the variable on the left.
A teacher has 29 pencils and puts them into boxes of 8. Write an expression to find the pencils left over.
29 % 8
Trace this code: `score = 12`; `backup = score`; `score = 20`. What is the value of `backup`?
12. `backup` keeps the value copied when the assignment happened.
A program creates a rectangle named `box` and sets its position, but nothing appears. What additional statement should be used?
`add(box)`.
A click handler receives an event object `event`. What information might `event.x` and `event.y` provide?
The x- and y-coordinates of the mouse click.Back to board
Trace these assignments: `a ← 4`, `b ← 11`, `c ← a`, `a ← b`, `b ← c`. What is the final value of `b`?
4. `c` stored the original value of `a`, then that value was assigned to `b`.
What is printed by x = 7 * 3 + 10 / 4; print(x) if written as two valid Python statements on separate lines?
23.5
In AP pseudocode: `p ← 6`, `q ← p`, `p ← 15`, `r ← q`. What value is stored in `r`?
6. `q` received 6 before `p` was changed.
A circle has a diameter of 70. What radius should be passed to `Circle()` to draw it at the correct size?
35, because radius = diameter ÷ 2.
A click handler creates a circle at the event's coordinates and adds it to the canvas. If the user clicks four different locations, what should happen?
Four circles should appear, one at each clicked location, assuming each click creates and adds a new circle.
Explain why `backup = total` does not automatically change `backup` when `total` is later assigned a new number.
The assignment copies the current value into `backup`; later reassignment of `total` does not automatically update `backup`.