Chapter 2

[*]Ex 2.1
INT minus thirty five = -35
[*]Ex 2.2

(a)
1
(b)
1.0
(c)
5.0
(d)
0
(e)
5
[*]Ex 2.3

(a)
6
(b)
-6
(c)
13.5
(d)
4.5

[*]Ex 2.4

(a)
5
(b)
-45.0
(c)
-61

[*]Ex 2.5

(a)
20 INT
(b)
1 INT
(c)
1.25 REAL
(d)
1 INT
(e)
17.0 REAL
[*]Ex 2.6
Your answer should be something like this:-
   PROGRAM ex2 6 CONTEXT VOID
   USE standard
   BEGIN
      print(-7 MOD 3);
      print( 7 MOD -3);
      print(-7 MOD -3)
   END
   FINISH
This will display
         +2          +1          +2
on your screen.
[*]Ex 2.7
REAL two pi = 2 * pi

[*]Ex 2.8

(a)
4 INT
(b)
3.25 REAL
(c)
12 INT

[*]Ex 2.9

(a)
-3 INT
(b)
-9 REAL
(c)
2.0 REAL
[*]Ex 2.10
1.5

[*]Ex 2.11

(a)
5
(b)
2
(c)
345
(d)
32
(e)
"1"
(f)
8
(g)
0.0
[*]Ex 2.12
The first print phrase displays
   $0.0000000000000000$
(16 zeros) and the second displays +infinity.
[*]Ex 2.13
The compiler detects the error and rejects it.
[*]Ex 2.14

(a)
The brackets should be replaced with parentheses.
(b)
There are more opening than closing parentheses. The first opening parenthesis should be deleted.
(c)
The operator ROUND has not been declared to use an operand with mode CHAR.
(d)
The operator ENTIER has not been declared for use with an operand with mode INT.

Sian Mountbatten 2012-01-19