Zebra0.com

alice proceduresAlice Programming

Alice Programming

Learn Alice in FREE step-by-step lessons.

Quiz on Class Procedures in Alice3: Reusable Code

After doing all parts of the lesson you should be able to answer these questions.

Write down the answers first. Click the check to check your answer.

1. What is the best way to break your code into small manageable pieces? answer

   Use procedures and functions

2. If you have a movie and want both the camel and the elephant to walk, what class would you write the walk procedure for? answer

   Quadruped

3. You have written some code for the bear to walk. When you copy the code to a procedure you will need to change bearCub to ___. answer

   this

4. A procedure header is shown below. What are amount, speed and number Of Times called?
answer

   parameters

5. A procedure header is shown below.

The calling statment is
How many times does the bear cub shake his head? answer

   3

6. The values that you see in the calling statement are called _____ answer

   arguments

7. What will the code below do?
answer

   The bear says “hello” at random intervals throughout the movie.

8. With the code shown below, when will the bear face the castleGate?
answer

   Never! This is an endless loop and the last line is never executed.

9. You have a movie with 5 different fish. You want all of them to swim. What is the best way to do this? answer

   Create a swim procedure for the Swimmer class.

Please review the material for any questions you miss.