Learn to Program using Alice

Practice Test for the Lesson Titled

Your First Alice Program

 

Published:  May 4, 2007
Last updated:  June 6, 2007
By Richard G. Baldwin

File: Alice0125PracticeTest.htm


Questions

1.  True or False:  The ability to interactively call methods provides at least the following two benefits:

  1. The ability to manually set the stage in a manner that is somewhat more precise than just dragging objects around with the mouse.
  2. The ability to create short animation sequences and manually execute them one step at a time to see if they do what you want them to do before you write the steps into your animation program.

Answer and Explanation

2.  True or False:  One of the weaknesses of Alice is that you must complete the program before you can click the Play button to see what you have accomplished.

Answer and Explanation

3.  True or False:  To create program listings of the source code for an Alice program, you pull down the File menu in the Alice development environment and select the menu item titled Export Web Page.

Answer and Explanation

4.  True or False:  When you create a program listing of the source code for an Alice program, the listing is written into an HTML file..

Answer and Explanation

5.  True or False:  A complete understanding of HTML file format is absolutely necessary in order to learn Alice programming.

Answer and Explanation

6.  True or False:  You must click the large Done button on the right side of the screen to switch from the Scene Edit screen to the Code Edit screen.

Answer and Explanation

7.  True or False:  One of the major disadvantages of Alice relative to other programming environments is that you must type all of your program code in Alice, whereas other programming environments use much easier drag-and-drop operations to write program code.

Answer and Explanation

8.  True or False:  To write programs in Alice, you drag tiles from other parts of the screen and drop them into the edit pane.

Answer and Explanation

9.  True or False:  When you begin a new program, and before you drag any tiles into the edit pane, the words Do Nothing will appear in the edit pane.  The first tile that you drop into the edit pane will replace those words with a line of program code.

Answer and Explanation

10.  True or False:  If you drop a tile and it ends up in the wrong position, you can drag it up and down the screen within the edit pane to correct the position.  Just grab the tile at the dotted handle on the left end, drag it to the correct position and drop it there.

Answer and Explanation

11.  True or False:  When you drag a tile to create a new line of code and hover at the edit screen, a red horizontal line will appear.  You can move the line up and down the screen within the contents of the edit pane by dragging the tile up and down accordingly.  Whenever the red line is in the correct position, and the border on the tile that you are dragging is red, you can drop the tile.  (Don't drop a tile when its border is green.)  When you drop the tile, it will produce a line of program code at the position of the red line.

Answer and Explanation

12.  True or False:  Sometimes you need to drag a tile to replace something in an existing line of program code instead of creating a new line of program code.  In that case, you will see a red box instead of a red line.  When you drop the tile, that will cause code to appear in place of the red box.

Answer and Explanation

13.  True or False:  If you look carefully at the tiles in the program edit pane, you will see that there is an area on the left end of each tile containing a large number of dots.  This is a handle, which is meant to be the place that you grab a tile with the mouse in order to drag it.

Answer and Explanation

14.  True or False:  If you create a line of program code and decide later that you really don't need it, you can drag it to the top of the screen and drop it into the trash can.  You can also right-click on the handle and a popup menu will appear with a delete option.  You can also use that option to get rid of lines of program code that you no longer need.

Answer and Explanation

15.  True or False:  A common approach to debugging programs is to disable some of the code and allow the remaining code to execute in an attempt to isolate the code that is causing a problem.

Answer and Explanation

16True or False:  You can disable code one line at a time, or one block at a time by right-clicking the handle and then selecting enable in the popup menu that appears.  To re-enable the code, just right-click the handle on the disabled code and select disable in the popup menu.

Answer and Explanation

17True or False:  If you need to rearrange the order of lines of program code, you can simply drag the individual lines up and down the screen to rearrange them into a different order.

Answer and Explanation

18True or False:  When you create a new Alice world, a skeleton for a world-level method named your first method or your_first_method (depending on the display format) is automatically created.

Answer and Explanation

19True or False:  The syntax for every method consists of a signature and a body.

Answer and Explanation

20True or False:  In Java display format, the body of a method is surrounded by matching parentheses characters as follows, ( body )

Answer and Explanation

21True or False:  The program code shown in Listing 1a will cause the center points of the ground, the parkingMeter, and the iceSkater to all be aligned, but they may not all be oriented in the same direction.

Listing 1a. The actual edit screen format for Listing 1.

Answer and Explanation

22True or False:  To begin writing the code shown in Listing 1a, select the ground object in the object tree and select the properties tab in the details panel below the object tree.

Answer and Explanation

23True or False:  Having selected ground in the object tree and the methods tab in the details panel, to write the first line of code in Listing 1a, drag the method tile named setPointOfView from the details panel and drop it on the words Do Nothing in the edit pane.  (The existence of Do Nothing in the edit pane assumes that the comment hasn't been placed in the edit pane yet.)  Select the entire world from the menu.

Answer and Explanation

24True or False:  The little silver triangles that you see following certain words in the edit pane (see Listing 1a) are there solely as an Alice trademark to distinguish Alice code from Java, C#, and C++.

Answer and Explanation

25True or False:  The little silver triangles that you see following certain words in the edit pane (see Listing 1a) indicate pull-down menus that allow you to specify other things about the program code.

Answer and Explanation

26True or False:  In Alice, C++, C#, and Java, comments begin with //.  (C++, C#, and Java may also allow other formats for comments.)  The purpose of a comment is to guide the program through a prescribed route for the execution of program code.

Answer and Explanation

27True or False:  To replicate the comment in Listing 1a, drag the tile showing // from below the edit pane and drop it right above the first line of program code.  It should appear there as a comment with the words No comment.  Click on those words and replace them with the words Align objects to the world.

Answer and Explanation

28True or False:  When you have a world running in Alice, you can click the Pause button in the World Running window to get back to the Code Edit screen.

Answer and Explanation

29True or False:  One of the reasons for breaking code up into modules, (such as Alice primitive methods and functions), is to make them easily re-usable.

Answer and Explanation

30True or False:  One of the shortcomings of Alice is a lack of modularization.  For example, every time we need to compute the square root of a number, we must "reinvent the wheel" and write the detailed code required to compute the square root ourselves.

Answer and Explanation

31True or False:  One reason for breaking a program up into modules is simply to provide better program organization.

Answer and Explanation

32True or False:  The following procedure can be used to change the name of the default method from my_first_method to main

Answer and Explanation

33True or False:  By default, the programming statements in an Alice program will be executed concurrently.

Answer and Explanation

34True or False:  A doInOrder block is used to ensure that all of the programming statements (or code blocks) enclosed in its body are executed in sequential order.  In addition, the use of a doInOrder block:

Answer and Explanation

35True or False:  You can use the standard Windows clipboard in typical ways for the cutting, copying, and pasting of text when writing an Alice program.

In addition, there is a picture of a special Alice clipboard in the upper-right corner of the Alice development screen.  Just like with Windows, you only have access to one special Alice clipboard, so you must use it judiciously.

You can drag individual programming statements, or entire blocks of statements to the clipboard from one part of a program and then drag them from the clipboard to another part of the program as a means of copying programming statements from one part of a program to another part of the program.

Answer and Explanation

36True or False:  In programming jargon, we say that when one method calls another method, control passes from the calling method to the called method.

Answer and Explanation

37True or False:  Figure 9 shows a partial screen shot resulting from clicking the triangle on the setPointOfView method and then selecting style in the first popup menu that appeared.

Figure 9. Setting the duration.

Answer and Explanation

38True or False:  Figure 9 shows a partial screen shot resulting from clicking the triangle on the setPointOfView method and then selecting duration in the first popup menu that appeared.  Selecting duration caused the second popup menu to appear.  Selecting an amount of time from that menu specifies how long the program should take in executing the action specified by that program instruction.

Answer and Explanation

39True or False:  Setting the opacity property for an object to 100% during the manual process of setting the stage will make the object invisible when the program starts running.

Answer and Explanation

40True or False:  One of the tiles that appears below the program edit pane is labeled doTogether.  If you drag that tile into your program, and then put two or more program instructions inside the matching pair of curly braces associated with that tile, all of the instructions (or code blocks) within those curly braces will be executed concurrently.

Answer and Explanation



Copyright 2007, Richard G. Baldwin.  Faculty and staff of public and private non-profit educational institutions are granted a license to reproduce and to use this material for purposes consistent with the teaching process.  This license does not extend to commercial ventures.  Otherwise, reproduction in whole or in part in any form or medium without express written permission from Richard Baldwin is prohibited.


The following image is the splash screen from Alice 2.0, and is the property of the developers of Alice at Carnegie Mellon.

Answers and Explanations


Answer 40

True

Explanation 40

Back to Question 40
 


Answer 39

False - set opacity property to 0%, not 100%

Explanation 39

Back to Question 39
 


Answer 38

True

Explanation 38

Back to Question 38
 


Answer 37

False - duration, not style

Explanation 37

Back to Question 37
 


Answer 36

True

Explanation 36

Back to Question 36
 


Answer 35

False

Explanation 35

Back to Question 35
 


Answer 34

True

Explanation 34

Back to Question 34
 


Answer 33

False - sequentially (in the order that they appear in the program), not concurrently

Explanation 33

Back to Question 33
 


Answer 32

True

Explanation 32

Back to Question 32
 


Answer 31

True

Explanation 31

Back to Question 31
 


Answer 30

False

Explanation 30

Back to Question 30
 


Answer 29

True

Explanation 29

Back to Question 29
 


Answer 28

False - Click Stop, not Pause.

Explanation 28

Back to Question 28
 


Answer 27

True

Explanation 27

Back to Question 27
 


Answer 26

False

Explanation 26

Back to Question 26
 


Answer 25

True

Explanation 25

Back to Question 25
 


Answer 24

False

Explanation 24

Back to Question 24
 


Answer 23

True

Explanation 23

Back to Question 23
 


Answer 22

False - Select the methods tab, not the properties tab.

Explanation 22

Back to Question 22
 


Answer 21

False

Explanation 21

Back to Question 21
 


Answer 20

False

Explanation 20

Back to Question 20
 


Answer 19

True

Explanation 19

Back to Question 19


Answer 18

False - should be my_first_method instead of your_first_method

Explanation 18

Back to Question 18


Answer 17

True

Explanation 17

Back to Question 17


Answer 16

False - the words disable and enable were reversed.

Explanation 16

Back to Question 16


Answer 15

True

Explanation 15

Back to Question 15


Answer 14

True

Explanation 14

Back to Question 14


Answer 13

True

Explanation 13

Back to Question 13


Answer 12

False - the words red and green were reversed

Explanation 12

Back to Question 12


Answer 11

False - the words red and green were reversed.

Explanation 11

Back to Question 11


Answer 10

True

Explanation 10

Back to Question 10


Answer 9

True

Explanation 9

Back to Question 9


Answer 8

True

Explanation 8

Back to Question 8


Answer 7

False

Explanation 7

Back to Question 7


Answer 6

True

Explanation 6

Back to Question 6


Answer 5

False

Explanation 5

Back to Question 5


Answer 4

True

Explanation 4

Back to Question 4


Answer 3

False

Explanation 3

Back to Question 3


 

Answer 2

False

Explanation 2

Back to Question 2


Answer 1

True

Explanation 1

Back to Question 1


Copyright 2007, Richard G. Baldwin.  Faculty and staff of public and private non-profit educational institutions are granted a license to reproduce and to use this material for purposes consistent with the teaching process.  This license does not extend to commercial ventures.  Otherwise, reproduction in whole or in part in any form or medium without express written permission from Richard Baldwin is prohibited.

The following image is the splash screen from Alice 2.0, and is the property of the developers of Alice at Carnegie Mellon.

-end-