Learn to Program using Alice

Practice Test for the Lesson Titled

Expressions and Operators

Published:  June 7, 2007
By Richard G. Baldwin

File: Alice0160PracticeTest.htm


Questions

1.  True or False:  Computer programs consist of expressions, which in turn consist of statements.

Answer and Explanation

2.  True or False:  An expression is a specific combination of operators and operands, which evaluates to a particular result.  The operands can be variables, literals, or method calls that return a value.

Answer and Explanation

3.  True or False:  A statement is a specific combination of expressions.

Answer and Explanation

4.  True or False:  Operands are the action elements of a computer program.

They perform actions such as:

Answer and Explanation

5.  True or False:  Operators operate on operands.  Stated differently, operands are the things that are operated on by operators.

Answer and Explanation

6.  True or False:  An operator that operates on one operand is called a binary operator.

Answer and Explanation

7.  True or False:  An operator that operates on two operands is called a binary operator. 

Answer and Explanation

8.  True or False:  According to the current jargon, binary operators in Alice use prefix notation.  This means that the operator appears between its operands.

Answer and Explanation

9.  True or False:  In Alice, there is at least one unary operator that uses postfix notation.  This operator is the increment operator.

Answer and Explanation

10.  True or False:  As a result of performing the specified action, an operator can be said to return a value (or evaluate to a value) of a given type.

Answer and Explanation

11.  True or False:  Alice supports the operators in the following list:

   +        Adds its operands
   -        Subtracts the right operand
            from the left operand
   *        Multiplies the operands 
   /        Divides the left operand by
            the right operand
   %        Remainder of dividing the 
            left operand by the right 
            operand - modulus operator

Answer and Explanation

12.  True or False:  The arithmetic operators in Alice are exposed whenever you click the triangle immediately to the right of a component in an expression that can serve as the left operand for the operator.

Answer and Explanation

13.  True or False:  Alice supports the equality operators shown in the following list:

   ==       Returns true if operands are equal.
            Otherwise returns false.
   !=       Returns true if operands are not equal.
            Otherwise returns false.

Answer and Explanation

14.  True or False:  The equality operators in the following list produce results of type Number.

   ==       Returns true if operands are equal.
            Otherwise returns false.
   !=       Returns true if operands are not equal.
            Otherwise returns false.

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 14

False

Explanation 14

Back to Question 14


Answer 13

True

Explanation 13

Back to Question 13


Answer 12

True

Explanation 12

Back to Question 12


Answer 11

False

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

False

Explanation 8

Back to Question 8


Answer 7

True

Explanation 7

Back to Question 7


Answer 6

False

Explanation 6

Back to Question 6


Answer 5

True

Explanation 5

Back to Question 5


Answer 4

False

Explanation 4

Back to Question 4


Answer 3

True

Explanation 3

Back to Question 3


 

Answer 2

True

Explanation 2

Back to Question 2


Answer 1

False

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-