Solutions to other tests:
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  

Mathematics for the Digital Age
and
Programming in Python


>>> Second Edition

Test 2

1.
A
2.
(a) T   (b) T   (c) F  
3.
C
4.
D
5.
D
6.
(a) F   (b) T   (c) T  
7.
A
8.
D
9.
C
10.
(a), (c), (d), (e)
11.
B
12.
C
13.
(a), (d), (g), (h)
14.
(a) F   (b) F   (c) T  
15.
(a), (b), (c), (d)
16.
D
17.
(a), (b), (c), (d)
18.
(a) F   (b) T   (c) T   (d) F
19.
B
20.
C

21.
def badCode(x):
    x = x + 1
    <--Return x
22.
True, False, None
23.
def print3Lines(): print('---\n+ +\n---')
24.
def abbrev(s):
    '''Returns a string that consists of the first three characters in s'''
    return s[0] + s[1] + s[2]
25.
def double(str):
    n = int(str)
    return str(n + n)
26.
def sumReciprocals(n): sumR = 0 i = 1 while i <= n: sumR = sumR + 1/i i = i + 1 return sumR




Copyright © 2010 by Skylight Publishing