What's the main advantage of a general-purpose language like Python over Blockly?
- A.Python programs always run faster
- B.It isn't limited to the blocks someone built, and it opens up libraries other people have already written and tested
- C.Python makes it impossible to write a program with mistakes in it
- D.Blockly cannot do loops or functions
Answer Why?
A program starts with "from XRPLib.rangefinder import Rangefinder" and then calls rangefinder.distance(). It fails with a NameError. What was skipped?
- A.Step 2 — no instance was made, so the name rangefinder means nothing yet
- B.Step 1 — the import line is wrong
- C.The program needs to import Rangefinder twice
- D.Nothing — distance() only works in Blockly
Answer Why?
Where do the three steps actually go in a real program?
- A.Steps 1 and 2 go near the top and run once; step 3 goes wherever the program needs that device, as often as it likes
- B.All three must be written together, in that order, every time
- C.Step 2 has to be repeated before each use of the device
- D.They can go in any order as long as all three are present
Answer Why?
Which line is written correctly?
- A.Print("Driving...")
- B.print "Driving..."
- C.print("Driving...")
- D.print(Driving...)
Answer Why?
What do the parentheses in board.wait_for_button() do?
- A.They tell Python to call the function — and anything inside them is an argument passed to it
- B.They are decoration; Python ignores them
- C.They mean the function returns nothing
- D.They are only needed when there is something inside them
Answer Why?
Why does drivetrain.straight(-30) drive the robot backward?
- A.Negative numbers reverse the direction — same as a negative cm in the Straight block
- B.It drives forward 30 cm, then stops
- C.It turns instead of driving
- D.It causes an error
Answer Why?
Find the bug in the code above.
- A.straight should be capitalized
- B.Print should be lowercase: print
- C.The distances should be positive
- D.There is no bug
Answer Why?