Week3 Data Representation
Week3 Data Representation
Week3 Data Representation
Systems
Data Representation
1
Data
• Data
Collection of raw, unorganized facts.
Consists of numbers, text, symbols or just description of things.
• Information
Processed data is called information.
2
Data and Information
• Data
• Unprocessed
• Unorganized
• Non-structured
• eg:- Chaithra, 83, Science, Maths, Rithika, 95
• Information
• Processed
• Organized
• Structured
3
Types of Data
• Numeric
• Character String (Text)
• Audio
• Images
• Videos
4
Data Representation
100000100000
100001110010
101011110011
110011010110
123abc
5
Numeric Data Representation
6
Text Data Representation
7
Audio Representation
8
Image & Video Representation
9
Takeaways
• What is data?
• Data vs Information.
• Different types of data.
• How each type is
represented?
10
References
11
Foundations of Computer
`
Systems
Objectives
1
Numeric Data
2
Numeric Data Representation
• Unsigned
• Binary conversion
• Signed
• Sign and Magnitude
• One’s Complement
• Two’s Complement
3
Number Systems
4
Types of Number System
• Decimal
• Binary
• Octal
• Hexadecimal
5
Number Notation
• Decimal number
• Example: (29)10 commonly represented as 29
• Binary number
• Example: (1100)2
• Octal number
• Example: (35)8
• Hexadecimal number
• Example: (1D)16
6
Unsigned Numeric
Data Representation
• Any number system can be represented to its binary
equivalent by the binary conversion technique.
7
Decimal to Binary Conversion
8
Decimal (Base 10) to Binary Conversion
(160)10 2 160
2 80 0
2 40 0
2 20 0 (160)10 = (10100000)2
2 10 0
2 5 0
2 2 1
2 1 0
0 1
9
Floating Point Decimal Number
to Binary Conversion
(169.9)10
Integer Part = 169 Fractional Part = 0.9
2 169 .9 x 2 = 1.8
169 = 10101001
2 84 1 1 .8 x 2 = 1.6
2 42 0 1 .6 x 2 = 1.2 0.9 = 1110011
2 21 0 1 .2 x 2 = 0.4
2 10 1 0 .4 x 2 = 0.8
0 .8 x 2 = 1.6
2 5 0 1 .6 x 2 = 1.2 (169.9)10 =
2 2 1 1 .2 x 2 = 0.4
2 1 0 (10101001.1110011)2
0 .4 x 2 = 0.8
0 1
10
Takeaways
11
Foundations of Computer
`
Systems
Objectives
• Signed number
representation.
• 1’s complement.
• 2’s complement.
1
Signed Numeric Data
2
Signed Numeric Data
Representation
3
Signed Magnitude Method
magnitude.
4
Signed Magnitude Method
– (2n-1-1) to +(2n-1-1) -1
Binary equivalent of 1 in two
bit : 01
Including MSB bit: 1 01
111
Decimal equivalent of 11 is: 3
5
1’s Complement Method
• The positive numbers are
represented just like the normal
binary representation.
• The negative numbers are
represented using the 1’s complement representation of its
positive counterpart.
6
1’s Complement Method
-(2n-1-1) to + (2n-1-1)
100
1’s complement of 100 is: 011
7
Obtaining 2’s complement for a
binary number
• Flip all bits to obtain its 1’s complement equivalent.
9
2’s Complement Method
–(2n-1) to + (2n-1-1).
101
2’s complement of 101 is: 011
10
Obtaining 2’s complement for a
binary number
• First find the 1’s complement.
• Then add 1 to it to obtain the 2’s complement equivalent.
Binary number : 11000010
11
Takeaways
12
References
13
Foundations of Computer
`
Systems
Objectives
1
Text Data and its Representation
• Text Data
• Alpha-numeric data
• Special characters
• Mainly represented using
• ASCII
• Unicode
• Each symbols are assigned with a special code.
• The code is then converted to binary.
• Finally, the entire text is represented as a long string of bits.
2
ASCII-Facts
3
ASCII Codes
4
ASCII Table
5
ASCII Table
6
Text Representation using ASCII
• Eg Computer Essentials.
• Step 1: Convert each character to its ASCII Decimal value using
the ASCII table.
Like C = 67, o = 111, m = 109, p = 112, …etc
7
Text Conversion using ASCII
•
Step 2 : Convert each decimal value into its 8-bit equivalent binary.
77 = 01001101 121= 01111001 32= 00100000 ….
Binary Representation
Text Representation using ASCII 01000011 01101111 01101101
67 111 109 112 117 116 101 114 01110000 01110101 01110100
32 69 115 115 101 110 116 105 97 01100101 01110010 00100000
108 115 01000101 01110011 01110011
01100101 01101110 01110100
01101001 01100001 01101100
01110011
8
Unicode - Facts
9
Unicode and UTF
10
UTF : Unicode Transformation
Unit
• UTF has several character encoding forms like:
• UTF-8: Only uses one byte (8 bits) to encode
English characters.
• UTF-16: Uses two bytes (16 bits) to encode the most
used characters.
• UTF-32: Uses four bytes (32 bits) to encode the characters.
11
Takeaways
12
References
13
Foundations of Computer
`
Systems
Objectives
1
Audio Representation
• Analog Signal
• Continuous & time-varying.
• Amplitude changes continuously.
• Often represented in the form of sine waves.
• Audio data is analog in nature.
• Digital Signal
• Discrete and time separated
• Represented by square waves
2
Representing Audio as Binary
Data
• Quantization :- The amplitude of analog audio data, which has
a continuous range of values, is first quantized to a set of
discrete values.
• Sampling:- The samples whose amplitude has to be recorded
is then obtained.
• The amplitude of the samples are then converted to
its corresponding binary values.
3
Representing Audio as Binary
Data
4
Digital Image Representation
5
Types of Images
• Binary Image
• Grayscale Image
• Colour Image
6
Binary Images
7
Grayscale Images
• 0 for Black
• 255 for White
8
Colour Images
9
Digital Video
10
Takeaways
• Audio Representation.
• Digital Image
Representation.
• Types of images.
• Video Representation.
11
References
12