Chapter 4

Contents: True/False | Multiple Choice | Discussion | Programs

True/False

  1. False
  2. True
  3. False
  4. True
  5. True
  6. True
  7. True
  8. False
  9. True
  10. False

Multiple Choice

  1. d
  2. c
  3. a
  4. c
  5. c
  6. d
  7. b
  8. c
  9. c
  10. a

Discussion

  1. These can be checked interactively.
    1. 'The knights who say ni!'
    2. 'spamspamspamni!ni!'
    3. 'p'
    4. 'pa'
    5. 'ani'
    6. 'spam!'
    7. 'SPAM'
    8. 'NI! NI! NI! '
  2. Answers may vary and can be checked interactively.
    1. string.upper(s2[:-1])
    2. s2+s1+s2
    3. ((string.capwords(s1+" "+s2)+"  ")*3)[:-2]
    4. s1
    5. string.split(s1,"a")
    6. string.join(string.split(s1,"a"),"")
  3. Answers can be checked interactively.
    1. a
      a
      r
      d
      v
      a
      r
      k
    2. Now
      is
      the
      winter
      of
      our
      discontent...
    3. M ss ss pp
    4. scrt
    5. tfdsfu
  4. Answers can be checked interactively.
    1. 'Looks like spam and eggs for breakfast'
    2. 'There is 1 spam 4 you'
    3. Error -- More values than slots
    4. '2.30 2.35'
    5. '2.30000 2.34680'
    6. 'Time left 01:37.37'
    7. Error -- Value should be an int
  5. Private keys must be known by both parties ahead of time. When contacting sites on the internet, say for e-commerce, there would be no practical way for the parties to exchange the private key.

Programming Exercises

Code for Chapter 4 Exercises