Download presentation
Presentation is loading. Please wait.
Published byChristal Wright Modified over 9 years ago
1
Information and Programs
2
Foundations of Computing Information –Binary numbers –Integers and Floating Point –Booleans (True, False) –Characters –Variables Programs –Expressions –Assignment –Sequences
3
Information Binary numbers Integers and Floating Point Booleans (True, False) Characters Variables
4
Decimal Numbers Each digit is a power of ten 12345 = 5 * 1 + 4 * 10 + 3 * 100 + 2 * 1000 + 1 * 10,000
5
Binary Numbers Each Digit is a power of two 10110 = 1 * 0 + 2 * 1 + 4 * 1 + 8 * 0 + 16 * 1 = 22
6
Binary Numbers Each Digit is a power of two 1011101 = = 93 1 * 1 + 2 * 0 + 4 * 1 + 8 * 1 + 16 * 1+ 32 * 0 + 64 * 1
7
Why Binary? Any physical phenomenon that has two states can be used to store a binary number 11010= 26
8
Magnetism + - + - + + Magnetic Material Read/Write Head 1 101011 = 43
9
Voltage +5 000 100101= 37
10
Holes in Paper Light = 1 Dark = 0 101010 = 42 Photo Sensor Light
11
Binary Students Male = 0 Female = 1
12
Why Binary? Any physical phenomenon that has two states can be used to store a binary number Each binary digit is called a BIT –1010 - is a 4 bit number –01010100 - is an 8 bit number An 8 bit number is called a BYTE
13
Size of a Binary Number How many different numbers can you store in 2 bits? How many can you store in 8 bits? In general, 2 (number of bits) numbers can be stored How many in 10 bits? –1024 = 1K How many in 20 bits? –1,048,576 = 1Meg
14
Information Binary numbers Integers and Floating Point Booleans (True, False) Characters Variables
15
Integers 100 100245 -45
16
Size of an Integer How many bits required for the number 17? 5 bits How many bits for the number 1023? 10 bits
17
Integer Expressions * means multiply / means divide 2*4+3 = 11 2*(4+3) = 14 (7+9)/2 = 8
18
Floating point numbers Numbers with decimal points 1.23 5623.1232 -0.00232
19
Floating point numbers Numbers with decimal points 1.23 = 0.123e1 5623.1232 = 0.56231232e4 -0.00232=-0.232e-2 Stored differently (sign + fraction + exponent)
20
Information Binary numbers Integers and Floating Point Booleans (True, False) Characters Variables
21
Booleans 1 = true 0 = false
22
Boolean Expressions (7>3) is true ((2+4)<6) is false > Greater than < less than <= less than or equal >= greater than or equal == equal != not equal 7<=6 is false 6!=5 is true
23
Information Binary numbers Integers and Floating Point Booleans (True, False) Characters Variables
24
ASCII Code for Characters Every character is defined to have an 8 bit (1 byte) number What is special about the order of the numbers? Type ‘g’ Store 103
25
ASCII Code for Characters A numeric character is different from its ASCII number
26
ASCII Code for Characters Dad32@Abc 68 97 100 51 50 64 65 98 99
27
What about Chinese, Sanscrit, Hebrew, Cyrillic, etc ??
28
UNICODE rather than ASCII 2 Bytes per character –Twice as much space –65,536 possible characters (2^16)
29
Expressions with characters ‘A’ + 2 = ‘C’ ‘g’- ‘d’ = 3 ‘F’ + 32 = ‘f’ ‘A’ < ‘D’ is true ‘%’ >= ‘+’ is false
30
Information Binary numbers Integers and Floating Point Booleans (True, False) Characters Variables
31
Variable A named place to store a value –George = 32 –Size = 17 –Weight = 120
32
Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1;
33
Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1;
34
Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1; A + 13 75 + 13 = 88
35
Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1; A-B+3 75 - 88 + 3 = -10
36
Program A sequence of things to do A = 75; B = A+13; A = A-B+3; C = A/2 + 1; A / 2 + 1 -10 / 2 + 1 = -4
37
Review Binary numbers (using any two states) Integers and Floating Point –Expressions (+ - * /) Booleans (true, false) ( = == !=) Characters –ASCII, UNICODE Variables Programs
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.