

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The questions and solutions for exam 2 of the cmsc 203 course in the fall 2004 semester. The exam covers topics such as prime numbers, the greatest common divisor (gcd), recursion, the quotient-remainder theorem, and polynomial evaluation. Students are expected to answer true or false questions, find the next terms of recursive sequences, apply the quotient-remainder theorem to integers, and evaluate polynomials.
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Exam 2 CMSC 203 Fall 2004
1. Circle T if the corresponding statement is True or F if it is False. T F Every integer greater than 1 is divisible by a prime. T F For all integers a, b, and c , if b divides a and c divides a , then GCD( b,c ) = 1. T F Every iterative algorithm can be expressed as a recursive algorithm. T F 1 + 2 + 3 + ... + 1,000,000 = 500,000(1,000,000). T F For integers a and b , if a and b are relatively prime, then GCD( a,b ) = 1. T F The Fibonacci Sequence is 1, 1, 2, 3, 5, 8, 13, 21, ....
T F (3 1000 โ 3999 ) + (3^999 โ 3 998 ) + ... + (3^3 โ 32 ) + (3 2 โ 3) + ( 3 โ 1) is a Telescoping Series. T F For any non-zero integers a and b , ab = GCD( a,b )LCM( a,b ).
(b) Given the sequences, { an } and { bn }, defined for n > 0, by: an = 2 n^ and b (^) n = n^2 , find c 0 , c 1 , c 2 , and c 3 when c (^) n = an + bn.
3. List out an algorithm to apply the Quotient-Remainder Theorem to integers n and d. 4. The following algorithms evaluate the polynomial a (^) nx n^ + an โ 1 x n^ โ^1 +...+ a 1 x + a 0 at x = c. Step
through each to evaluate 2 x^3 + x^2 + 2 x + 1 at x = 3.
procedure poly1 ( c , a 0 , a 1 , ..., an : real numbers)
power := 1 y := a 0
for i = 1 to n power := power * c y := y + a (^) i * power
next i output y
procedure poly2 ( c , a 0 , a 1 , ..., an : real numbers)
y := an
for i = 1 to n y := y * c + an โ i
next i output y
i 0 1 2 3
poly1 power = power = power = power = ai = ai = ai = ai = y = y = y = y = poly2 a (^) n โ i = an โ i = an โ i = an โ i =
y = y = y = y =
Docsity.com
5. Use the Euclidean Algorithm to find GCD(1452, 630). 6. Given the sequence { ai } where an +1 = (2 an + 1) mod 4, calculate the next 5 terms
when a 0 = 1. What do you observe about the sequence?
7. Calculate the following without using a calculator:
(a) (b)
8. Prove 2 of the 3 Theorems below using Weak or Strong Mathematical Induction.
Theorem 1: For all integers n > 0,
Theorem 2: If an = an -1 + an -2 + an -3 + an -4 and a 0 = a 1 = a 2 = a 3 = 4, then an < 4 n^ for all n > 3.
Theorem 3: Every set with n elements has 2 n^ subsets.
i
i = 0
100
i = 0
100
9 i i = 0
n
9 n^ +^1 โ 1 8