5.1 Solutions

    1. 6.94
    2. 10.81
    3. atomicMass(2)
    4. atomicMass(1)
    5. 1, 2, 3, 4, 5
    6. int
    7. real
    1. 'S'
    2. cipher('B')
    3. cipher('D')
    4. 'Z'
    5. 'Z'
    6. 'I'
    7. char
    8. char
    1. 11 [to calculate: 1990 - 1980 + 1 = 11]
      last index - first index + 1
      if you actually count them all you'll get 11
    2. 21 [10 - (-10) + 1 = 21]
    3. 8 [count as you say the alphabet]
    4. 11 [5 - (-5) + 1 = 11]
    5. 2
  1. Since we don't know all the values in (a) and (b) we'll just create the arrays. For (c) we'll also initialize
    1. var temperature : array 0 .. 12 of int 
    2. var mark : array 1 .. 10 of int 
    3. var quantity : array 'A' .. 'D' of int := init(240, 185, 210, 375)