CompSci 94 Fall 22 Exam 1 Solutions 1. B 2A. Decimal number 2B. direction 2C. object 2D. TextString 3. A 4. With parameters you will write less code since you do not need to make multiple copies of a function with one slight change. Instead you add a parameter. 5. C 6. A 7. B 8A. 8, 9, 10, 11, 12 8B. story 8C. camel, quadruped 8D. "red train", 8.46, this.bear 8E. phrase, amount, creature 8F. this.bear move forward number 8G. bunny will be smaller 8H. IGNORE, NOT GRADED 9. See additional page for drawing 10A. camera move and orient to pig (camera in pig facing same direction as pig) camera move forward 1.5 camera turn right 0.5 cameraPigView move and orient to camera (poodle was renamed to cameraPigView) ALTERNATE SOLN: camera moveTo cow camera orientTo Upright camera move up 1.0 camera turn right 0.25 camera move forward 0.5 cameraPigView move and orient to camera 10B. this.camera move and orientTo camera PigView 11. this.hare move to this.yetiBaby this.hare turn left 1.0 asSeenBy this.pig this.hare turnToFace this.panda this.hare move up 2.0 * this.panda getHeight this.hare move forward this.hare getDistanceTo this.panda + randomRealNumberInRange 1.0, 2.0 this.hare move down 2.0 * this.panda getHeight + (this.hare getHeight * 0.5) do together this.panda turn backward 0.25 this.pig turn right 0.25 12A. procedure RideAndSpin Biped creature, DecimalNumber numberSpins, DecimalNumber howHigh do together this turnToFace creature creature turnToFace this this move forward this getDistanceInFrontOf creature - 1.0 this move up creature getHeight - 0.5 this move forward 1.3 this turn right 0.5 this setVehicle creature creature move up howHigh creature turn right numberSpins creature move down howHigh