CS 70, Fall 2004, Midterm 1 Questions and Solutions, Exams of Discrete Mathematics

The questions and solutions for the midterm exam of cs 70 (discrete mathematics and probability theory) course at the university of california, berkeley in fall 2004. The exam covers various topics such as number theory, induction, graph theory, rsa, polynomials, and berlekamp-welsh algorithm. The questions require the students to apply their knowledge of these topics to solve problems and prove statements.

Typology: Exams

2012/2013

Uploaded on 04/27/2013

ascharya
ascharya ๐Ÿ‡ฎ๐Ÿ‡ณ

4.6

(21)

166 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PRIN T your name: ,
(last) (first)
SIGN your name:
PRIN T your username on cory.eecs:
WRITE your section number (101 or 102):
Three sides of 8.5 by 11 sheet of notes is permitted. No calculators are permitted. Do all your work on the
pages of this examination. If you need more space, you may use the reverse side of the page, but try to use
the reverse of the same page where the problem is stated.
You have 110 minutes. The questions are of varying difficulty, so avoid spending too long on any one
question.
Do not turn this page until the instructor tells you to do so.
Problem 1
Problem 2
Problem 3
Problem 4
Problem 5
Problem 6
Total
CS 70, Fall 2004, Midterm 1 1
Docsity.com
pf3
pf4
pf5

Partial preview of the text

Download CS 70, Fall 2004, Midterm 1 Questions and Solutions and more Exams Discrete Mathematics in PDF only on Docsity!

PRINT your name: , (last) (first)

SIGN your name:

PRINT your username on cory.eecs:

WRITE your section number (101 or 102):

Three sides of 8.5 by 11 sheet of notes is permitted. No calculators are permitted. Do all your work on the pages of this examination. If you need more space, you may use the reverse side of the page, but try to use the reverse of the same page where the problem is stated.

You have 110 minutes. The questions are of varying difficulty, so avoid spending too long on any one question.

Do not turn this page until the instructor tells you to do so.

Problem 1

Problem 2

Problem 3

Problem 4

Problem 5

Problem 6

Total

CS 70, Fall 2004, Midterm 1 1

Problem 1. [True or false] (25 points)

Circle TRUE or FALSE. There is no need to justify your answers on this problem.

(a) TRUE or FALSE: If the implication 6 P =โ‡’ Q is true, then 6 Q =โ‡’ P. True

(b) TRUE or FALSE: If A or B is true and B are true than A must be true.

(c) TRUE or FALSE: gcd ( n + 1 , 2 n + 1 ) = 1. True. Apply Euclidโ€™s algorithm.

(d) TRUE or FALSE: For all n > 1, 2 n^ โˆ’ 1 is prime.

False. 24 โˆ’ 1 = 15 is not prime.

(e) TRUE or FALSE: For all odd n , gcd ( n , n โˆ’ 2 ) = 1. True. Assume n = ad and n โˆ’ 2 = a โ€ฒ d , then n and n โˆ’ 2 must differ by at least d (or be the same number) but d cannot be 2.

(f) TRUE or FALSE: For all a , m , am โˆ’^1 = 1 mod p. False. a = 0 for any m.

(g) TRUE or FALSE: For all a , m = pq , where p and q are prime, a ( p โˆ’^1 )( q โˆ’^1 )^ = 1 mod m.

False. a = 0 for any m.

(h) TRUE or FALSE: For all a , m = pq , where gcd ( a , m ) = 1 and p and q are prime, a ( p โˆ’^1 )( q โˆ’^1 )^ = 1 mod m

True. Fermatโ€™s little theorem.

(i) TRUE or FALSE: 5 has an inverse mod 12? True. 5 is the inverse of 5 mod 12.

(j) TRUE or FALSE: The complete graph on n nodes is the graph where every pair of nodes is an edge. The complete graph on n nodes is Eulerian for n odd. True. The degree is n โˆ’ 1 which is even which implies that the graph is Eulerian.

CS 70, Fall 2004, Midterm 1 2

Problem 3. [Graphs] (5 points)

Prove that the complete graph on n nodes is Hamiltonian, for n โ‰ฅ 3.

Proof. A number of proofs work here. Here is one. The sequence of nodes 1,... n , is a hamiltonion cycle since every edge ( i , i + 1 ) and the edge ( n , 1 ) is present.

Here is another. A three node comlete graph is hamiltonian. Given that the n โˆ’ 1 node complete graph is hamiltonian, one can construct a Hamiltonian cycle in the n node complete graph by noting that removing a single node yields an n โˆ’ 1 node complete graph, forming a Hamiltonian cycle in that graph, and then inserting the new node at any point in the Hamiltonian cycle. The new path is hamiltonian since the new node is connected to its predecesser and successor.

CS 70, Fall 2004, Midterm 1 4

Problem 4. [RSA] (20 points)

  1. Say Bob is generating an RSA pair from p = 5 and p = 7. Say he chooses e = 3. What is the problem? The RSA scheme requires that d = e โˆ’^1 mod ( q โˆ’ 1 )( p โˆ’ 1 ).
  2. Say he chooses e = 5, what would the decryption key d be?
  3. Encrypt the message 6.
  4. Why is encrypting 5 a bad idea?

CS 70, Fall 2004, Midterm 1 5

Problem 6. [Berlekemp-Welsh] (15 points)

Consider a message m 1 ,... , mn where each mi is a field element. Consider the degree n โˆ’ 1 polynomial P where P ( i ) = mi. Recall that knowing any n correct points on the polynomial allows us to reconstruct the polynomial.

  1. Consider a set of n + 2 k points where at least n + k of them lie on P ( x ). Argue that the only degree n โˆ’ 1 polynomial that hits at least n + k of these points is P ( x ).
  2. Consider a transmission of the polynomial encoding, where errors occur at points 0, 1 and 2. What is the definition of the error polynomial defined in our lecture on the Berlekamp-Welsh lecture?

CS 70, Fall 2004, Midterm 1 7