An Exercise in Operators:

Consider the following variable assignments (assume that each has already been declared):

a = 100;
b = 75;
c = 25;
d = 1;
e = "Donald"
f = "Duck"
g = "10"
h = "75"

What is the result of the following operations or conditions (remember, operations will result in a string or a number, conditions will be true or false). Identify if the output is a string, a number, or a Boolean value.  A good way to proceed would be to replace each variable with the value it currently holds and then perform the operation:

1.         a + b

2.         a % b

3.         e + f

4.         e + g

5.         c * d

6.         g + h

 7.        f + g

 8.        d + h

9.        ((b/c) < a)

10.      ((a%b) == c)

11.      ((c>a) || (b<a))

12.       (h==b)

 

When you have written out your answers on paper, check them against this key to see how you did.  Remember, this is for YOUR benefit, so try to figure them out first, look at the key last!