Sense · Move · Code
Programming test. Show what you can do.
Four days ago most of you had never connected a sensor to a motor. Since then you have built a robot, written events, found and fixed bugs, planned in pseudocode and run a real lab. This test asks you to show all of it on paper. Read every question twice. When a question asks you to explain, use the words we learned.
Absent today? You will take this test with me. See me as soon as you are back to set a time before or after school or during lunch. Use the Day 4 page and your notebook to study first.
Name ________________________________
Class period ________
Date ______________
Score ______ / 50
Part A · Words · 7 points
Write the letter of the best definition next to each word.
- ____ input
- ____ output
- ____ sequence
- ____ event
- ____ debugging
- ____ pseudocode
- ____ decomposition
A. Steps done in a specific order
B. A program written as plain sentences, for people to read
C. Information that goes into a system
D. Finding and fixing the reason a program does not do what you meant
E. Something that happens that a program is waiting for
F. Breaking a big job into smaller jobs
G. What a system does in response
Part B · Input or output · 6 points
Write IN for input or OUT for output.
- ____ The color sensor reading a green brick
- ____ The double motor turning two wheels
- ____ Tilting a lever on the controller
- ____ The single motor lifting an arm
- ____ A light turning on when the program says so
- ____ A red brick held up in front of the sensor
Part C · Multiple choice · 8 points
Circle the best answer.
1. What does a connection card do?
a. Charges the motor
b. Pairs two pieces of hardware so they work together
c. Stores your program
d. Turns the color sensor on
2. Why does an event block have a rounded top, like a hat?
a. So it looks different from a motor block
b. Because it must be the last block in a stack
c. Because nothing comes before an event, so nothing can snap above it
d. So it can only be used once
3. Blocks that are snapped together in a stack run…
a. all at the same time
b. from bottom to top
c. in a random order
d. from top to bottom, in order
4. A program waits for a blue brick, but the team only has red, yellow and green bricks. What happens?
a. The robot treats green as blue
b. That event never happens
c. The program crashes
d. The robot runs that stack once anyway
5. Your program does not work. What is the best first step?
a. Delete it and start over
b. Change three things at once to save time
c. Read it out loud from the top, one block at a time
d. Ask another team for their program
6. Who is pseudocode written for?
a. The robot
b. The computer
c. The people on the team
d. The LEGO website
7. Which step is small enough to turn into a block?
a. Go to the kitchen
b. Run both motors forward for 2 seconds
c. Do the delivery
d. Be careful
8. On Friday the color sensor read correctly at 1 cm but often missed at 3 cm. What does that tell a scientist?
a. The sensor is broken
b. Every instrument has a range where it can be trusted
c. Colors change with distance
d. The program has a bug
Part D · Read the code · 9 points
Say exactly what the robot does.
1. The sensor is shown a yellow brick.
What does the motor do? (3 pts)
______________________________
______________________________
2. The program starts.
Where is the arm at the end, up or down? How do you know? (3 pts)
______________________________
______________________________
3. The sensor is shown a green brick.
What does the robot do, and why? (3 pts)
______________________________
______________________________
Part E · Find the bug · 8 points
Each program has one bug. Name it and fix it.
1. The team wanted the rover to drive forward for 3 seconds and stop. It barely moves.
The bug: ______________________________
The fix: ______________________________
2. The team wanted a sorter that pushes red bricks left and green bricks right. Green bricks never move.
The bug: ______________________________
The fix: ______________________________
Part F · Plan it · 8 points
Decompose the job, then write the pseudocode.
The job: A crane robot waits beside a truck. When it sees yellow, it lowers its hook a quarter turn, waits 2 seconds while a load is attached, raises the hook a quarter turn, and spins to the left for 1 second. When it sees red, it stops everything.
1. Break the yellow job into at least four smaller jobs, in order. (3 pts)
______________________________________________
______________________________________________
______________________________________________
2. Write the pseudocode for the whole program, both colors. One action per line. (5 pts)
______________________________________________
______________________________________________
______________________________________________
______________________________________________
______________________________________________
______________________________________________
______________________________________________
Part G · Your lab · 4 points
Friday’s lab, in your class.
Physics. A robot travels 84 cm in a 4-second run. (a) What is its average speed in cm/s? Show your work. (b) On a distance-time graph, a faster setting makes a steeper line. Explain why, using the word slope.
______________________________________________
______________________________________________
______________________________________________
Chemistry. (a) Your sensor read correctly 5 out of 5 times at 1 cm and 2 out of 5 times at 3 cm. What is the percent correct at each distance? (b) Why is one flame color a clue, but not proof, of which element is in a sample?
______________________________________________
______________________________________________
______________________________________________
IPC. In a tug of war, the left robot pulls with 6 N and the right robot pulls with 4 N. (a) What is the net force, and which way does the rope move? (b) If both robots pulled with 5 N, what would happen, and what is that called?
______________________________________________
______________________________________________
______________________________________________
Standards. Science and engineering practices (strand 1) in P.1, C.1, IPC.1; Physics P.5A; IPC IPC.5B. CSTA grades 6–8: 2-AP-10 pseudocode and algorithms; 2-AP-13 decomposition; 2-AP-17 testing and refining programs; 2-CS-02 hardware and software that collect and exchange data.
Teacher notes · Test
Printing: use the Print button. Each student’s copy shows the Part G question for the class selected on screen, so choose the class before printing each set. The answer key is not on this page; it was delivered to you separately.
Points: A 7, B 6, C 8, D 9, E 8, F 8, G 4. Total 50.