Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1.

Similar presentations


Presentation on theme: "CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1."— Presentation transcript:

1 CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall alphonce@cse.buffalo.edu 1

2 Announcements If this is your first class, pick up a syllabus. Reminder: no recitations this week! 2

3 Today’s lessons A computer is a very simple machine. All information is encoded using bit strings. We decide how to interpret a bit string. We program computers using high- level languages. 3

4 physical vs. logical perspectives Physical reality: Logical view: WIRE Carries a HIGH voltage or a LOW voltage WIRE Carries a 1 or a 0 4

5 Idea 5

6 Controlling flow 0 6

7 1 7

8 Two in a row? 0 8

9 AND gate For which input values is output 1? For which input values is output 0? Inputs are on left Output is on right 9

10 OR gate For which input values is output 1? For which input values is output 0? Inputs are on left Output is on right 10

11 NOT gate For which input value is output 1? For which input value is output 0? Input is on left Output is on right 11

12 Flip-flop (a bit of memory!) S (set) R (reset) remembered value 12

13 Counting Decimal (base 10) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 etc. Binary (base 2) 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 etc. 13

14 Bit string A ‘0’ or ‘1’ is a binary digit, or a bit. A sequence of bits is called a bit string. For example: –1101 is a bit string 14

15 Number systems Decimal (base 10) Each position is weighted by a power of 10. E.g. 734 = –7*100 + 3*10 + 4*1 –7*10 2 + 3*10 1 + 4*10 0 E.g. 1101 = –1*1000 + 1*100 + 0*10 + 1*1 –1*10 3 + 1*10 2 + 0*10 1 + 1*10 0 Binary (base 2) Each position is weighted by a power of 2. E.g. 111 = –1*4 + 1*2 + 1*1 = “seven” –1*2 2 + 1*2 1 + 1*2 0 E.g. 1101 = –1*8 + 1*4 + 0*2 + 1*1 = “thirteen” –1*2 3 + 1*2 2 + 0*2 1 + 1*2 0 15

16 Interpretation QUESTION: –What does the bit string 1101 represent? 16

17 Interpretation QUESTION: –What does the bit string 1101 represent? ANSWER: –Whatever we want it to represent! 17

18 Representations Binary (non-negative numbers) Two’s complement (integers) IEEE 754 (approx. floating point numbers) ASCII / EBCDIC / Unicode (characters) etc. 18

19 Questions? 19


Download ppt "CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1."

Similar presentations


Ads by Google