Binary Number System - Discrete Mathematics - Solved Exam, Exams of Discrete Mathematics

This exam paper is very helpful for the student of discrete mathematics. The major points in these exam paper are: Binary Number System, N-Digit System, Define Complement, Complement Representations, Boolean Algebra, Proof of Consensus Theorem, Laws and Theorems, Boolean Equality, Boolean Function, Minimal Expression

Typology: Exams

2012/2013

Uploaded on 04/23/2013

sarangapani
sarangapani 🇮🇳

4.5

(10)

62 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE20 Final Exam (June 11, 2012) Solution
1. (number systems: one’s complement) Show the operation of 17 + (14)in one’s
complement of binary number system. Assume that each binary number is represented
with 10 bits. (10 points)
17 =100012
=00000100012
14 =11102
=00000011102
14 =1111111111200000011102
=11111100012
1714 =00000100012+11111100012
=00000000102+1
=00000000112
(1)
2. (number systems: two’s complement) We have defined and learned the idea of two’s
complement for n-bit binary numbers.
2.1. Define the complement (corresponding to two’s) using an n-digit system with base
8. (5 points)
x8nx
Range = [4×8n1,4×8n11](2)
2.2. Show the arithmetic of xywhere x=118and y=178in the complement repre-
sentations (corresponding to two’s) using a 5-digit system with base 8. (5 points)
x=118
=000118
y=000178
y=777778000178+18
=777618
xy=000118+777618
=777728
(3)
1
Docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Binary Number System - Discrete Mathematics - Solved Exam and more Exams Discrete Mathematics in PDF only on Docsity!

CSE20 Final Exam (June 11, 2012) Solution

  1. (number systems: one’s complement) Show the operation of 17 + (− 14 ) in one’s complement of binary number system. Assume that each binary number is represented with 10 bits. (10 points)
  1. (number systems: two’s complement) We have defined and learned the idea of two’s complement for n-bit binary numbers. 2.1. Define the complement (corresponding to two’s) using an n-digit system with base
  2. (5 points)

x ⇒ 8 n^ − x Range = [− 4 × 8 n −^1 , 4 × 8 n −^1 − 1 ]

2.2. Show the arithmetic of xy where x = 118 and y = 178 in the complement repre- sentations (corresponding to two’s) using a 5-digit system with base 8. (5 points)

x = (^118) = (^000118) y = (^000178) − y = 777778 − 000178 + (^18) = (^777618) xy = 000118 + (^777618) = (^777728)

  1. (Boolean algebra: proof of consensus theorem) Prove the following equality using Boolean algebra laws and theorems. 3.1 Prove the consensus theorem: ab + ac = ab + ac + bc. (5 points)

ab + ac + bc = ab + ac + 1 ∗ bc ( identity ) = ab + ac + ( a + a ′) bc ( complement ) = ab + ac + abc + abc ( distributive ) = ab + abc + ac + abc ( commutative ) = ab ( 1 + c ) + ac ( 1 + b ) ( distributive ) = ab + ac ( boundness )

3.2 Prove the Boolean equality ( a + b )( a ′^ + c ) = ( a + b )( a ′^ + c )( b + c ). (5 points)

( a + b )( a ′^ + c )( b + c ) = ( aa ′^ + ac + ab + bc )( b + c ) ( distributive ) = ( ac + ab + bc )( b + c ) ( complmenet ) = abc + acc + abb + abc + bbc + bcc ( distributive ) = abc + ac + ab + abc + bc ( idempotent ) = ac ( b + 1 ) + ab ( c + 1 ) + bc ( distributive ) = ac + ab + bc ( boundness ) = 0 + ac + ab + bc ( identity ) = aa + ac + ab + bc ( complement ) = a ( a ′^ + c ) + b ( a ′^ + c ) ( distributive ) = ( a + b )( a ′^ + c ) ( distributive )

  1. (recursive function: permutation) Suppose all the permutations on the set of { 1 , 2 , 3 , 4 , 5 , 6 } are listed in lexicographic order from 0 to 6! − 1. 6.1 What is the RANK (order) in the list for 453261? (10 points)

RANK ( 453261 ) = 3 × 5! + 3 × 4! + 2 × 3! + 1 × 2! + 1 × 1!

= 3 × 120 + 3 × 24 + 2 × 6 + 1 × 2 + 1 × 1

6.2 What permutation will have the RANK 165? (5 points)

Assume the permutation to be a 6 a 5 a 4 a 3 a 2 a 1 , local rank to be ri for i th level. Originally we start from level 6 and have r 6 = 165.

q 6 = r 6 /5! = 1 r 5 = r 6 − q 6 × 5! = 45 a 6 = { 1 , 2 , 3 , 4 , 5 , 6 } = 2 q 5 = r 5 /4! = 1 a 5 = { 1 , 3 , 4 , 5 , 6 } = 3 r 4 = r 5 − q 5 × 4! = 21 q 4 = r 4 /3! = 3 a 4 = { 1 , 4 , 5 , 6 } = 6 r 3 = r 4 − q 4 × 3! = 3 q 3 = r 3 /2! = 1 a 3 = { 1 , 4 , 5 } = 4 r 2 = r 3 − q 3 × 2! = 1 q 2 = r 2 /1! = 1 a 2 = { 1 , 5 } = 5 r 1 = r 2 − q 2 × 1! = 0 q 1 = r 1 /0! = 0 a 1 = { 1 } = 1

So we have the permutation for RANK 165 as

a 6 a 5 a 4 a 3 a 2 a 1 = 236451

  1. (recursive function: induction) Use induction to prove the following identity for any positive integer n : 1 × 2 + 2 × 3 + ... + ( n − 1 ) × n = n ( n − 1 )( n + 1 )/3. (10 points)

From the question we have the following.

an = n ( n − 1 ) sum ( n ) = Σ ni = 1 ai f ( n ) = n ( n − 1 )( n + 1 )/ 3

And we need to prove that

n ∈ { 1 , 2 ,.. ., +∞} , sum ( n ) = f ( n )

Base case:

sum ( 1 ) = 1 × ( 1 − 1 ) = 0 f ( 1 ) = 1 × ( 1 − 1 ) × ( 1 + 1 )/ 3 = 0 ⇒ sum ( 1 ) = f ( 1 )

Assumption:

k > 0 s.t. sum ( k ) = Σ ki = 1 ai = f ( k ) = k ( k − 1 )( k + 1 )/ 3

Incremental case:

sum ( k + 1 ) = Σ k i =+ 11 ai = Σ ki = 1 ai + ak + 1 = sum ( k ) + ak + 1 = k ( k − 1 )( k + 1 )/ 3 + k ( k + 1 ) = k ( k + 1 ) (( k − 1 )/ 3 + 1 ) = k ( k + 1 )( k + 2 )/ 3 = [( k + 1 )][( k + 1 ) − 1 ][( k + 1 ) + 1 ]/ 3 = f ( k + 1 )

  1. (recursive function) A frog knows 3 jumping styles ( A , B , C ). With style A the frog jumps forward by 1 feet, and with styles, B , C , the frog jumps forward by 2 feet. Let ai denote the number of ways to jump over a total distance of i feet. 9.1. Write the values of a 1 , a 2 , a 3? (5 points)

a 1 = 1 a 2 = 1 × 1 + 2 = 3 a 3 = 1 × a 2 + 2 × a 1 = 5

9.2. Derive the recursive formula of an? (5 points)

an = an − 1 + 2 × an − 2

9.3. Find the solution of the recursion. (5 points)

x^2 = x + 2 = x^2 − x − 2 = ( x − 2 )( x + 1 ) ⇒ r 1 = 2 r 2 = − 1 ⇒ an = c 1 ( r 1 ) n^ + c 2 ( r 2 ) n = c 12 n^ + c 2 (− 1 ) n a 1 = 2 c 1 − c 2 = 1 a 2 = 4 c 1 + c 2 = 3 ⇒ c 1 = (^23)

c 2 = 1 3 ⇒ an = 23 × 2 n^ + 13 × (− 1 ) n