quiz: generations of computer technology · word = group of bits that the computer processes at a...

65
QUIZ: Generations of computer technology Hardware: 1. 2. 3. 4. 5. 1

Upload: others

Post on 24-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ: Generations of computer technology

Hardware:

1.

2.

3.

4.

5.

1

Page 2: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ: Generations of computer technology

Software:

1.

2.

3.

4.

5.

6.2

Page 3: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Steampunk !

3

Page 4: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Steampunk – Wikipedia article 4

The Telectroscope, 1878-2008

Page 5: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Chapter 2

Binary Values and Number Systems

We are here!

Page 6: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Numbers

62

Natural numbers, a.k.a. positive integersZero and any number obtained by repeatedly

adding one to it.

Examples: 100, 0, 45645, 32

Negative numbersA value less than 0, with a – sign

Examples: -24, -1, -45645, -32

Page 7: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

73

IntegersA natural number, a negative number,

zero

Examples: 249, 0, - 45645, - 32

Rational numbersAn integer or the quotient of two integers

Examples: -249, -1, 0, 3/7, -2/5

Page 8: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

83

Real numbersIn general cannot be represented as the

quotient of any two integers. They have an

infinite # of fractional digits, so they cannot

be represented exactly in a computer.

Examples: Pi = 3.1415926535…

e = 2.718281828…

Page 9: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

2.2 Positional notation

9

4

How many ones (units) are there in 642?

600 + 40 + 2

6 x 100 + 4 x 10 + 2 x 1

6 x 102 + 4 x 101 + 2 x 100

10 is called the base

We also write 64210

This is called the

polynomial expansion of the

number

Page 10: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ

104

How many units are there in 6429 (642 in base nine)?

Hint: Convert it to decimal using the polynomial

expansion, as in the previous example:

600 + 40 + 2

6 x 100 + 4 x 10 + 2 x 1

6 x 102 + 4 x 101 + 2 x 100

Page 11: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Solution

114

6 x 92 + 4 x 91 + 2 x 90 = 52410

Final answer: 6429 = 52410

Page 12: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Positional Notation

125

The base (a.k.a. radix) of a number

determines how many digits are used and the

value of each digit’s position.

To be specific:

• In base R, there are R digits, from 0 to R-1.

• The positions have for values the powers of

R, from right to left: R0, R1, R2, …

Page 13: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Positional Notation

137

dn * Rn-1 + dn-1 * Rn-2 + ... + d2 * R + d1

Formula:

R is the base

of the number

n is the number of

digits in the number

d is the digit in the

ith position

in the number

Page 14: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Positional Notation reloaded

147

dn * Rn-1 + dn-1 * Rn-2 + ... + d2 * R + d1

… but, in CS, the digits are numbered from zero, to

match the power of the base:

dn-1 * Rn-1 + dn-2 * Rn-2 + ... + d1 * R1 + d0 * R0

The text shows the digits numbered like this:

Page 15: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ

1568

Convert 642 in base 13 to decimal.

Page 16: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Solution

1668

Final answer: 64213 = 106810

+ 6 x 132 = 6 x 169 = 1014

+ 4 x 131 = 4 x 13 = 52

+ 2 x 13º = 2 x 1 = 2

= 1068 in base 10

Page 17: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Nota bene!

17

In a given base R, the digits range

from 0 up to R – 1

R itself cannot be a digit in base R

Trick problem:

Convert the number 473 from base 6 to base 10

Page 18: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Binary

189

Decimal is base 10 and

has 10 digits:

0,1,2,3,4,5,6,7,8,9

Binary is base 2 and has 2

digits:

0,1

Page 19: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ: Converting Binary to Decimal

19

What is the decimal equivalent of the binary

number 110 1110?

110 11102 = ???10

13

Page 20: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

20

What is the decimal equivalent of the binary

number 1101110?

1 x 26 = 1 x 64 = 64

+ 1 x 25 = 1 x 32 = 32

+ 0 x 24 = 0 x 16 = 0

+ 1 x 23 = 1 x 8 = 8

+ 1 x 22 = 1 x 4 = 4

+ 1 x 21 = 1 x 2 = 2

+ 0 x 2º = 0 x 1 = 0

= 110 in base 10

= 11010

Page 21: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Base 8 = octal system

21

What is the decimal equivalent of the octal

number 642?

6428 = ???10

11

Page 22: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Converting Octal to Decimal

22

What is the decimal equivalent of the octal

number 642?

6 x 82 = 6 x 64 = 384

+ 4 x 81 = 4 x 8 = 32

+ 2 x 8º = 2 x 1 = 2

Add the above = 418 in base 10

= 41810

11

Page 23: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Bases Higher than 10

2310

How are digits in bases higher than 10

represented?

Base 16 (hexadecimal, a.k.a. hex) has 16

digits:

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, F

Page 24: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Converting Hexadecimal to Decimal

24

What is the decimal equivalent of the

hexadecimal number DEF?

D x 162 = 13 x 256 = 3328

+ E x 161 = 14 x 16 = 224

+ F x 16º = 15 x 1 = 15

= 3567 in base 10

Page 25: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ:

2AF16 = ???10

25

Page 26: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Are there any non-positional number systems?

Hint: Why did the Roman civilization have no contributions to mathematics?

26

Page 27: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ: Convert to decimal

0001 00112 =

C716 =

426 =

718 =

27

Page 28: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

The inverse problem: Converting Base 10 to Other Bases

28

While (the quotient is not zero)Divide the decimal number by RMake the remainder the next digit to the left in the

answerReplace the original decimal number with the quotient

Algorithm for converting a number in base

10 to any other base R:

19

Known as repeated division (by the base)

Page 29: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Converting Decimal to Binary

29

Example: Convert 17910 to binary

179 2 = 89 rem. 1

2 = 44 rem. 1

2 = 22 rem. 0

2 = 11 rem. 0

2 = 5 rem. 1

2 = 2 rem. 1

2 = 1 rem. 0

17910 = 101100112 2 = 0 rem. 1

Notes: The first bit obtained is the rightmost (a.k.a. LSB)

The algorithm stops when the quotient (not the remainder!)

becomes zero

19

LSBMSB

Page 30: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Repeated division QUIZ

30

Convert 4210 to binary

42 2 = rem.

Final answer:

4210 = 2

19

Page 31: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

The repeated division algorithm can be used to convert from any

base into any other base (but normally we use it only for 10 → 2)

31

For next time: Read text example on p.43: Converting Decimal to Hex using repeated division

Page 32: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Today we’ve covered pp.35-41 and 42-45

of text (we skipped Arithmetic in Other

Bases, will cover it next time)

Solve in notebook quick work for next

class:

1 – 4 , 14 – 17, 21, 33a (only!)

32

Page 33: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ: Convert to decimal using polynomial expansion:

1101 00112 =

AB716 =

5137 =

6828 =

33

Page 34: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

QUIZ

Explain in your own words the

difference between a positional and a

non-positional number system.

34

Page 35: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Extra-credit QUIZ

35

Page 36: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Addition in Binary

36

Remember that there are only 2 digits in binary,

0 and 1

1 + 1 is 0 with a carry

Carry Values0 1 1 1 1 1

1 0 1 0 1 1 1

+1 0 0 1 0 1 1

1 0 1 0 0 0 1 0

14

Page 37: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Addition QUIZ

37

Carry values

go here1 0 1 0 1 1 0

+1 0 0 0 0 1 1

14

Check in base ten!

Page 38: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Compute in binary

Putting it all together!

38

1

1001

+ 101

1110

Python

(or another

high-level language) Convert decimal

to binary

Convert binary to decimal

Computer hardware

Page 39: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

SKIP:

Binary SUBTRACTION (with “borrow” bits)

• p.42 of text

• FYI, a few slides are provided at the end of this document.

39

Page 40: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Direct conversions between bases that are powers of 2

40

binary hexadecimal

octalbinary

Page 41: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Converting between Binary and Octal

41

• Mark groups of three bits (R to L)

• Convert each group

10101011 10 101 011

2 5 3

10101011 is 253 in base 8

17

Page 42: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Converting between Binary and Hex

42

• Mark groups of four bits (R to L)

• Convert each group

10101011 1010 1011

A B

10101011 is AB in base 16

18

Page 43: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

End-of-chapter ex.37

4314

Perform the following octal additions:

a. 770 + 665

b. 101 + 707

Page 44: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

End-of-chapter ex.38

4414

Perform the following hex additions:

a. 19AB6 + 43

Page 45: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Counting

45

Page 46: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

46

Hex

Page 47: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Conclusion:

• In order to represent any octal digit, we need ____ bits

• In order to represent any hex digit, we need ____ bits

47

Page 48: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

• If we have 3 bits, we can create _____ (how many?) different combinations of 0s and 1s.

• If we have 4 bits, we can create _____ (how many?) different combinations of 0s and 1s.

• If we have 5 bits, we can create _____ (how many?) different combinations of 0s and 1s.

• If we have N bits, we can create _____ (how many?) different combinations of 0s and 1s.

48

Page 49: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

• If we have 3 bits, we can create 23 = 8 different combinations of 0s and 1s.

• If we have 4 bits, we can create 24 = 16 different combinations of 0s and 1s.

• If we have 5 bits, we can create 25 = 32 different combinations of 0s and 1s.

• If we have N bits, we can create 2N different combinations of 0s and 1s.

49

Page 50: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Source: AP CS Principles – Course and Exam Descriptions

Your turn:

Page 51: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Source: AP CS Principles – Course and Exam Descriptions

Solution

𝟐𝟔𝟒

𝟐𝟑𝟐= 𝟐𝟔𝟒−𝟑𝟐 = 𝟐𝟑𝟐

Page 52: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Binary and Computers

52

Word = group of bits that the computer processes

at a time. Can differ from one comp. to another.

The number of bits in a word determines the

word length of the computer. It is usually a

multiple of 8.

1 Byte = 8 bits (on all computers!)

• 8, 16, 32, 64-bit computers

• 128? 256?

23

Page 53: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Read bio: Grace Murray Hopper

53

• Ph.D. in mathematics

• Wrote “A-0”, the world’s first

compiler, in 1952!

• Co-invented COBOL

• Rear-admiral of the US Navy

• “Nanosecond” wires

Page 54: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Grace also liked telling this story

54Harvard University Mark II Aiken Relay Calculator

Page 55: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Read: Ethical Issues →The FISA Court

55

Page 56: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Quick workTo do by next class, before starting to work

on homework:

• Read the entire Chapter 2

• SKIP: Binary subtraction with borrow bits (p.42)

• Answer end-of-chapter questions 6 – 13 in your notebook

56

This is not homework!Do not turn in for

grading!

Page 57: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Homework for Ch.2Due next Tue, Sep 18, at beginning of

lecture, hard-copy, not electronic!

• End-of-chapter ex. 23, 24, 25, 28, 29, 30, 33bcde, 38bc

57

Page 58: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Addition QUIZ

58

Carry values

go here1 1 1 0 1 1 0

+1 0 0 0 1 1 1

14

Page 59: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Solution

59

Carry values

1 1 1 0 1 1 0

+1 0 0 0 1 1 1

14

Check in base ten!

1 0 0 0 1 1 0

1 0 1 1 1 1 0 1

Page 60: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

End-of-chapter ex.37

6014

Perform the following octal additions:

c. 202 + 667

Page 61: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

FYI: Subtraction in Binary

61

Remember borrowing?

1 2

0 2 0 2

1 0 1 0 1 1 1

- 1 1 1 0 1 1

0 0 1 1 1 0 0

15

Borrow values

Check in base ten!

Page 62: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Subtraction QUIZ

62

1 0 1 0 0 0 0

- 1 0 0 1 0 1

15

Borrow values

go here

Check in base ten!

Page 63: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Subtraction QUIZ

63

1 1 1 0 1 0 0

- 1 1 0 1 1 1

15

Check in base ten!

Borrow values

go here

Page 64: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Another subtraction QUIZ

64

1 0 1 0 0 0 1

- 1 0 0 1 1 1

15

Borrow values

go here

Check in base ten!

Page 65: QUIZ: Generations of computer technology · Word = group of bits that the computer processes at a time. Can differ from one comp. to another. The number of bits in a word determines

Chapter Review questions• Describe positional notation (polynomial in the base)

• Convert numbers in other bases to base 10

• Convert base-10 numbers to numbers in other bases, esp. binary

• Add and subtract in binary

• Convert between bases 2, 8, and 16 using groups of digits

• Count in any base, esp. binary

• Explain the importance in CS of the bases that are powers of 2

• What is the IEEE/ACM CS Curriculum and what are three issues in the “Tenth Strand”?

656