Exam 2 CMSC 203 Fall 2004: Mathematics Problems, Exams of Discrete Structures and Graph Theory

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

2012/2013

Uploaded on 04/27/2013

ashakiran
ashakiran ๐Ÿ‡ฎ๐Ÿ‡ณ

4.5

(27)

261 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Exam 2 CMSC 203 Fall 2004
1. Circle T if the corresponding statement is True or F if it is False.
TFEvery integer greater than 1 is divisible by a prime.
TFFor all integers a, b, and c, if b divides a and c divides a, then GCD(b,c) = 1.
TFEvery iterative algorithm can be expressed as a recursive algorithm.
TF1 + 2 + 3 + ... + 1,000,000 = 500,000(1,000,000).
TFFor integers a and b, if a and b are relatively prime, then GCD(a,b) = 1.
TFThe Fibonacci Sequence is 1, 1, 2, 3, 5, 8, 13, 21, ... .
TF(31000 โˆ’ 3999) + (3999 โˆ’ 3998) + ... + (33 โˆ’ 32) + (32 โˆ’ 3) + ( 3 โˆ’ 1) is a Telescoping Series.
TFFor any non-zero integers a and b, ab = GCD(a,b)LCM(a,b).
2. (a) Given the recursion defined as f(n) = f(n
โˆ’
1) + 2f(n
โˆ’
2) + 3f(n
โˆ’
3), find the next 4 terms
when f(0) = 0, f(1) = 1 and f(2) =
โˆ’
1
(b) Given the sequences, {an} and {bn}, defined for n > 0, by: an = 2n and bn = n2,
find c0, c1, c2, and c3 when cn = 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 anxn + an โˆ’ 1xn โˆ’ 1 +...+ a1x + a0 at x = c. Step
through each to evaluate 2x3 + x2 + 2x + 1 at x = 3.
procedure poly1 (c, a0, a1, ..., an : real numbers)
power := 1
y := a0
for i = 1 to n
power := power * c
y := y + ai * power
next i
output y
procedure poly2 (c, a0, a1, ..., an : real numbers)
y := an
for i = 1 to n
y := y*c + an โˆ’ i
next i
output y
i 01 23
poly1 power = power = power = power =
ai = ai = ai = ai =
y = y = y = y =
poly2 an โˆ’ i = an โˆ’ i = an โˆ’ i = an โˆ’ i =
y = y = y = y =
Docsity.com
pf2

Partial preview of the text

Download Exam 2 CMSC 203 Fall 2004: Mathematics Problems and more Exams Discrete Structures and Graph Theory in PDF only on Docsity!

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 ).

2. (a) Given the recursion defined as f( n ) = f( n โˆ’ 1) + 2f( n โˆ’ 2) + 3f( n โˆ’ 3), find the next 4 terms

when f(0) = 0, f(1) = 1 and f(2) = โˆ’ 1

(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

โˆ‘ 5 i^ +^2

i = 0

100

9 i i = 0

n

9 n^ +^1 โ€“ 1 8

Docsity.com