## Data Types and Variables

Published:  May 21, 2007
By Richard G. Baldwin

File: Alice0140PracticeTest.htm

## Questions

1.  True or False:  Alice is a type-insensitive programming language.

2.  True or False:  Of the fifteen types supported by Alice, four are somewhat general purpose types and the remainder are more specialized types.

3.  True or False:  You should just ignore the Transformable data type.

4.  True or False:  The most significant distinguishing characteristic of data of the type Number is that you cannot perform arithmetic using that data.

5.  True or False:  Alice subdivides the general numeric type into six different types, some of which are whole (integer) values, and some of which are allowed to have fractional parts.

6.  True or False:  Alice treats all numeric types as the single type Number.

7.  True or False:  The Boolean type is probably the simplest of all types in that data of this type can only have one of three different values: true, false, or maybe.

8.  True or False:  In Alice, data of the Boolean type originates primarily as a result of tests that compare one thing with another.

9.  True or False:  Data of type Object contains references to objects on which you can call methods and functions.

10.  True or False:  You can create variables of the Object type and save references to objects in those variables.

11.  True or False:  Typically, data of type String contains what might be thought of as a label in the non-technical world.

12.  True or False:  If you store a telephone number as type String, you can perform arithmetic using that data provided that it consists solely of the digits from 0 through 9 inclusive.

13.  True or False:  It is possible to create new types in Alice.

14.  True or False:  Every local variable in Alice is identified as belonging to a specific type.  This means that the memory that has been set aside to be used as a variable can only be used to store a specific type of data.

15.  True or False:  All programming languages, including Alice, require data to be categorized into different types.

16True or False:  A variable is a place in memory where data of a specific type can be stored for later retrieval and use.

17True or False:  While each variable is given a name, it is not necessary that those names be unique.

18True or False:  In Alice, variables can exist in at least two different locations in a program:

• Inside a method or function
• Inside an object but outside of a method or function

19True or False:  Variables that exist inside an object but outside of a method or function are called properties in Alice.

20True or False:  Local variables can be used to carry data forward from one method call to the next call to the same method.

21True or False:  Properties belonging to an object exist during the entire running time of the program.

22True or False:  Unlike local variables, property variables are not identified with a specific type.

23True or False:  Once they have been declared, except for the fact that they have a much longer lifetime, the procedures for using property variables is pretty much the same as the procedures for using local variables.

24True or False:  When you create a new variable in Alice, you must specify the name and type of the variable.  You can optionally specify an initial value or accept the default initial value.

25True or False:  Whenever you need to use a local variable in your program code, you drag it down and drop it at the appropriate location in the program code.

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.

True

True

True

False

True

False

True

### Explanation 19

Back to Question 19

True

False

True

### Explanation 16

Back to Question 16

False

True

True

False

True

True

True

True

False

True

False

False

True

True

False

### Explanation 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-