Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types.

Similar presentations


Presentation on theme: "Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types."— Presentation transcript:

1 Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types.

2 Overview Representation of information. How is everything/anything represented 'in' the computer (in storage)? –ANSWER: everything is represented using 1s and 0s. What the 1s and 0s mean depends on what the information is, for example, the datatype whole number, number with fraction, true/false value, character string, other…

3 Storage Everything (data and programs) is stored in the circuitry of 'the computer'. The circuitry includes transistors that are switches: on or off states, 0 or 1. Each switch is called a bit. So….numbers are stored using the binary (base 2) system Symbols (characters, letters, etc.) are stored using agreed upon systems of encoding –ASCII: 8 bits per character –UNICODE: 16 bits per character

4 Why? Why not use circuits that can directly represent numbers using the decimal (base 10) system? Answer: Easier to make on/off switches than something with 10 states. Easier to build circuitry for calculations for the base 2 addition and base 2 times tables than the ones you remember…

5 What is stored? Numbers: binary number system Characters: ASCII or UNICODE encoding Machine instructions Composite datatypes, for example String of characters representing text –Will get to arrays Images More…

6 Recall base 10 Recall 1s column, 10s column, 100s column Recall borrowing (re-grouping) and carrying Do problem(s)

7 Base 2 Same principle –1s column, 2s column, 4s column, ???? Your age? My age? Addition –Subtraction? Multiplication?

8 Joke Explain joke on shirt

9 Bits A bit is a one or a zero (1 or 0). 3 bits can hold how many different patterns? 000, 001, 010, 011, 100, 101, 110, 111 4 bits can hold how many different patterns? What is the formula?

10 Byte A byte is 8 bits. See in specs for computers, memory, etc. KB, Kb, Gb, GB, other. So, how many patterns, what is the biggest number, held by a byte?

11 Another Joke

12 Base 16 Hexadecimal: used for quick way to describe bits, mostly commonly for color coding Symbols used are 0, 1, 2, …, 9, A, B, C, D, E, F You have seen color coding: RGB (red, green blue) in hexadecimal FF0000 is red 00FF00 is green ??

13 Numbers with fraction part Aka numbers with a decimal point How to represent? ANSWER: floating point numbers aka scientific notation –3.4521 * 10 2 is the same as 345.21 * 10 0 –Terminology: 3.4521 (or 345.21) is the mantissa or significand and the 2 (or 0) is the exponent. Computer format: use 2 or 16 in place of 10 Example using 32 bits: – 1 bit for the sign (0 for +, 1 for -) – 8 bits for the exponent –23 bits for the mantissa (width, i.e., 23, is the precision)

14 Characters ASCII coding The character A is represented by 01000001 The character a is represented by 01100001 The character 1 is represented by 00110001 The character 2 is represented by 00110010 …. Unicode is a 16 bit format big enough (hopefully) for all the world's languages

15 String of characters …such as a name or a label or a piece of text Fixed length: allocate 1 byte (8 bits) for each character –UNICODE 2 bytes Variable length: store string in two parts –One part holds length as a number and pointer (address) of the whole string –String itself

16 Boolean Named after George Boole True / False Theoretically: 1 bit, 0 for false, 1 for true but The addressability requirement means it could be 1 byte or even bigger String of Booleans can be combined. –A byte can represent the answer to 8 true/false questions.

17 Images There are several different ways to represent images. Consider this simple way: – For each pixel, have 3 bytes of information: the bytes representing the level of red, green and blue. – So, for an image 400 by 300 pixels, how many bytes required for storage?

18 Machine instructions: back up Processing code is translated, multi-stage process, to basic language of the computer. Very, very basic instructions: –LR Load a register (part of the Central Processing Unit (CPU) with contents at particular address –AR add values in register –JUMP to a new instruction –Etc. Contains machine instruction command and other information, such as storage addresses, in binary.

19 Classwork / Homework Catch up. Upload of work past due, but will get some credit. Examine images and compare different types in quality and size. Make posting on forum.


Download ppt "Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types."

Similar presentations


Ads by Google