Uploaded by theswagone banana

1516 (2)

advertisement
ACSL
2015 - 2016
American Computer Science League
Classroom Division
1. Recursive Functions
Find f (0) given:
2 * f ( x + 2) − 3
f ( x) = 
3 * x + 2
2. Recursive Functions
Find f (5) given:
(2 * x + 1) * f ( x − 1)
f(x) = 
1
if x  6
if x  6
if x  1
if x = 1
3. Computer Number Systems
Which has the most 1’s in its binary representation?
4148 1B516 17810 20016 6008
4. Computer Number Systems
Determine the number of 1’s in the binary representation of the
solution of the following expression:
(7438 – AF16 + 1101001010002) * 25610
5. What Does This Program Do?
What is printed when this program is run?
a = 4: b = 10: c = 1: d = 2
if a <= b then a = a + b
if c * d >= a then b = b + c else c = c - d
if a / b <= 1 then a = c + a else b = d + b
if d ^ c < c ^ d then c = d else d = c
if ((a > b) or (c < d)) then b = a - b else c = d + c
print a / b + c * (a * b – c / d) / b
end
Contest #1
6. Recursive Functions
Find f (6) given:
2 * f ( x − 1) + f ( x − 2)

f ( x ) = 0
2

if x  3
if x = 2
if x = 1
7. Recursive Functions
Find f ( f ( f (16 ))) given:
 f ( x − 4) + 2

f ( x ) =  f ( x + 1) - 1
x + 3

if x  10
if 6  x  10
if x  6
8. Computer Number Systems
Which expression evaluates with the most 1’s when the answer is
expressed in binary?
A) 258 + 1C16 B) A016 – 1001102 C) B816 + 12710 D) 1118 + 10002
9. Computer Number Systems
What is the mean (average) of the following numbers expressed in
octal?
1010102 1328 3316 10101002 4416
10 What Does This Program Do?
What is printed when this program is run?
a = 16: b = 2: c = 4: d = 0: e = 5
if a < b then a = a + b else a = a - b
if a * d < c * e then a = a + d else c = c + e
if b ^ d = 1 then d = d + 1 else b = b + 1
if int(a / c) = a / c then a = a / c else a = a - c
if (a < e) or (b >= d) then a = e else b = d
if (b >= c) and (d <= e) then c = b - c else d = a - e
print a ^ d + b * e / a – c * (a / e + b ^ b)
end
b1
Download