Assignment 4 Sample problems

Post on 21-Mar-2016

47 views 0 download

description

Assignment 4 Sample problems. Convert the following decimal numbers to binary. 8 920. Convert the following decimal numbers to binary. 8 =>1000 920 =>1110011000. How can we get ?. 8 => 8*1= 2 3 =>1000 - PowerPoint PPT Presentation

Transcript of Assignment 4 Sample problems

Assignment 4 Sample problems

Convert the following decimal numbers to binary.

8 920

Convert the following decimal numbers to binary.

8 =>1000

920 =>1110011000

How can we get ?

8 => 8*1= 23

=>1000 920 =>512*1+256*1+128*1+16*1+8*1 => 29 +28 +27 +24 +23

=>1110011000

Convert the following Binary numbers to Decimal.

110100

100110011

Convert the following Binary numbers to Decimal.

110100 =>52100110011

=>307

How can we get ?

110100 => 1* 25 +1*24 +1*22

=52 100110011 =>1* 28 +1*25 +1* 24+1* 21+1* 20

= 307

Add the following binary numbers. Express your answers in binary.

101+011=?

11010+10001=?

Add the following binary numbers. Express your answers in binary.

101+011=1000

11010+10001=101011

How can we get ?

101+011 => 1 0 1 + 0 1 1

=> 1 0 0 0 11010+10001 => 1 1 0 1 0 + 1 0 0 0 1 => 1 0 1 0 1 1

Subtract the following binary numbers. Express your answers in binary.

101-001=?

11010-01001=?

Subtract the following binary numbers. Express your answers in binary.

101-001=100

11010-01001=10001

How can we get ?

101-001 => 1 0 1 - 0 0 1

=> 1 0 0 11010-01001 => 1 1 0 1 0 - 0 1 0 0 1 => 1 0 0 0 1

Is this statement True or False? 

If I have an 8-bit system, 10111001 + 00110000 will result in overflow.

Is this statement True or False? 

If I have an 8-bit system, 10111001 + 00110000 will result in overflow.

False

How can we get ?

1. 10111001 + 00110000Þ 10111001+ 00110000Þ 11101001

The result is still 8-bit, so the answer is False

Provide the two's complement of the following 8-bit numbers.

01001110

10010010

Provide the two's complement of the following 8-bit numbers.

01001110 => 10110010

10010010 => 01101110

How can we get ?1: 01001110 => 10110001 (invert bits) + 00000001 (add one) => 101100102: 10010010

=> 01101101 (invert bits) + 00000001 (add one) => 01101110

• Consider the Christmas lights circuit (with states) described in class. Let these be the expressions for the next states.• A: not A• B: A and B

Fill in the table with True or False where appropriate.Time Step (sec)

A B New A New B

0 False False True False

1 True False

2

3

Fill in the table with True or False where appropriate.Time Step (sec)

A B New A New B

0 False False True False

1 True False False False

2 False False True False

3 True False False False

The “period” of a pattern is the number of steps it takes before the pattern repeats. What is the period of this pattern?

The “period” of a pattern is the number of steps it takes before the pattern repeats. What is the period of this pattern?

2