Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 44

Acquiring Numeric

and
Textual Data
Contents
 Data Acquisition – Input Units
 Representation of Numeric Data
 Binary Encoding
 Number Systems

 Number System Conversion


 Representation of Characters
Types of data

Numeric data – Time invariant

Text Data – Time invariant

Image or Picture – Time invariant

Audio or Sound – Varies with time

Video or Moving pictures – Varies with time


Data Acquisition
Data acquisition
 Read relevant data using a device. (using input devices)
 Convert the data into a form that can be stored in memory. (Binary form)
 Apply transformation to reduce the amount of storage. (Encoding Schemes)
Input units
 Keyboard  Non printable control keys
 Delete key
 QWERTY Keyboard
 Return key
 Categories of keys  Arrow Keys
 Letter keys  Tab Key
 Digit keys  Shift Key
 Special Character keys  Ctrl key
 Non printable control keys
 Function keys
Character reader
 Hand held scanner
 A pen which emits light at its tip
 Used to read digits in a particular font
 White parts reflect light; dark parts do not reflect light
 Faster and accurate
Magnetic ink character reader - MICR
 To read specially styled characters printed on documents and cheques
using a magnetic ink.
 Magnetic Ink Character Writer.
Bar codes
 Bar code – Set of vertical lines with varying width.
 Bar Code Scanner
Representation of
Numeric Data
Internal representation of numeric data
 External representation
 Decimal numbers, bar code

 Internal representation
 Binary numbers
 Binary digits (bits)
 1 byte = 8 bits
 1 nibble = 4 bits

Numeric Data Numeric Data


Text Data Binary Data Text Data
Image Data (Stored – processed- Image Data
Audio Data stored) Audio Data
Video Data Video Data
Encoding of decimal numbers
 1 bit
0 1

 2 bits
00 01 10 11
 3 bits
000 001 010 011
100 101 110 111
 4 bits
0000 0001 0010 0011 0100 0101 0110 0111
1111 1000 1001 1010 1011 1100 1101 1110
Binary encoding …
0 1 2 3 4 5 6 7 8 9
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001

 57267
01010111001001100111
 Drawback
 Not suitable for arithmetic calculations
Number systems
 Decimal : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
 Binary : 0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101,
1110, 1111, 10000, 10001, …
 Hexadecimal : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11, 12, … 19, 1A,
1B, …
Powers of two

Power of 2 Decimal Abbreviation Power of 2 Decimal Abbreviation


Equivalent Equivalent
20 1 210 1024 1K
21 2 211 2048 2K
22 4 212 4096 4K
23 8 220 1048576 1M
24 16 221 2097152 2M
25 32 222 4194304 4M
26 64 230 1073741824 1G
27 128 231 2147483648 2G
28 256 240 1099511627776 1T
29 512 241 2199023255532 2T
Units of Data
 Lowest unit of data : bit (0, 1)
 1 byte = 8 bits (Most commonly used – fundamental unit of data)
 1 nibble = ½ byte = 4 bits
 1 K (Kilobyte) = 1024
 1 M (Megabyte) = 1024 Kilobytes = 1024 x 1024 bytes (~ Million)
 1 G (Gigabyte) = 1024 Megabytes = 1024 x 1024 x 1024 bytes (~Billion)
 1 T (Terabyte) = 1024 Gigabytes = 1024 x 1024 x 1024 x 1024 bytes
(~Trillion)
Binary to decimal conversion
 Positional number systems
 The value of each digit is determined by
 The digit
 The position of the digit
 The base or radix of the number system

 Decimal number system


 Ex. 6824
Digits : 6 8 2 4
Positions : 103 102 101 100
Base or Radix : 10
Value : 6 x 103 + 8 x 102 + 2 x 101 + 4 x 100
 Binary number system
 Ex. 110010
Digits : 1 1 0 0 1 0
Positions : 25 24 23 22 21 20
Base or Radix : 2
Value : 1 x 25 + 1 x 24 + 0 x 23 + 0 x 22 + 1 x 21 + 0 x 20 = 50
 Convert 10010101 to decimal

1 0 0 1 0 1 0 1
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
128 0 0 16 0 4 0 1
100101012 = 14910
Representation of fractions
 Decimal Number System

0.475 4 x 10-1 7 x 10-2 5 x 10-3


.4 .07 .005

 Binary Number System

0.1011 1x2-1 0x2-2 1x2-3 1x2-4


1x½ 0x¼ 1 x 1/8 1 x 1/16
1 x 0.5 0 x 0.25 1 x 0.125 1 x 0.0625
Decimal Equivalent = 0.6875
Number System
Conversion
 Convert 111011.1012 to decimal

1 1 1 0 1 1 1 0 1
25 24 23 22 21 20 2-1 2-2 2-3
32 16 8 4 2 1 0.5 0.25 0.125
32 16 8 0 2 1 0.5 0 0.125
59.625
 Convert 11000.00112 to decimal

1 1 0 0 0 0 0 1 1
24 23 22 21 20 2-1 2-2 2-3 2-4
16 8 4 2 1 0.5 0.25 0.125 0.0625
16 8 0 0 0 0 0 0.125 0.0625
24.1875
Decimal to binary conversion
 Convert 2910 to binary

2 29
2 14 1
2 7 0
2 3 1
2 1 1

2910 = 111012
 Convert 39510 to binary
2 395
2 197 1
2 98 1
2 49 0
2 24 1
2 12 0
2 6 0
2 3 0

2 1 1
39510 = 1100010112
Conversion of decimal fractions to binary
 Convert 0.812510 to binary

0.8125 x 2 1.625 1
0.625 x 2 1.25 1
0.25 x 2 0.5 0
0.5 x 2 1.0 1
0.812510 = (0.1101)2
 Convert 0.562510 to binary

0.5625 x 2 1.125 1
0.125 x 2 0.25 0
0.25 x 2 0.5 0
0.5 x 2 1.0 1
0.812510 = (0.1001)2
 Convert 0.310 to binary

0.3 x 2 0.6 0
0.6 x 2 1.2 1
0.2 x 2 0.4 0
0.4 x 2 0.8 0
0.8 x 2 1.6 1
0.6 x 2 1.2 1
0.310 = 0.010012
 A leather belt costs Rs. 136.75. What is the binary equivalent of this value
when it is stored in the computer?

2 136
2 68 0
2 34 0 0.75 * 2 = 1.5
2 17 0 0.5 * 2 = 1.0
2 8 1
2 4 0 Answer : 10001000.11
2 2 0
2 1 0
 The item code for a variety of brinjal is 6367. It costs Rs. 75.67 a kilo.
Represent the item code using binary encoding and the cost in binary
number system.
Item code : 6367
Binary code : 0110001101100111
Cost per kg : 75.67
Binary equivalent : 1001011.101010
2 75 0.67 * 2 = 1.34
2 37 1 0.34 * 2 = 0.68
2 18 1 0.68 * 2 = 1.36

2 9 0 0.36 * 2 = 0.72

2 4 1 0.72 * 2 = 1.44
0.44 * 2 = 0.88
2 2 0
0.88 * 2 = 1.76
2 1 0
0.76 * 2 = 1.52
0.52 * 2 = 1.04
0.04 * 2 = 0.08
Hexadecimal to Decimal Conversion

 Convert D6C116 to decimal

D 6 C 1
163 162 161 160
4096 256 16 1
13 x 4096 6 x 256 12 x 16 1x1
53248 1536 192 1
D6C116 = 5497710
Hexadecimal to Decimal Conversion

 Convert F9A.BC316 to decimal

F 9 A . B C 3
162 161 160 . 16-1 16-2 16-3
256 16 1 . 1/16 1/256 1/4096
15 x 256 9 x 16 10 x 1 . 11/16 12/256 3/4096
3840 144 10 . 0.6875 0.0468 0.000732
F9A.BC316 = 3994.73510
Hexadecimal representation

 Hexadecimal number system


 16 digits
 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
 16 = 24 = 4 bits for representing a hexadecimal digit

Decimal Binary Hexadecimal Decimal Binary Hexadecimal


0 0000 0 8 1000 8
1 0001 1 9 1001 9
2 0010 2 10 1010 A
3 0011 3 11 1011 B
4 0100 4 12 1100 C
5 0101 5 13 1101 D
6 0110 6 14 1110 E
7 0111 7 15 1111 F
Binary to hexadecimal conversion

 Convert 11111001101111000112 to hexadecimal.

0111 1100 1101 1110 0011


7 C D E 3
 Convert 1000111110000.00101102 to hexadecimal

0001 0001 1111 0000 . 0010 1100


1 1 F 0 . 2 C
Representation of
Characters
Representation of characters

 Character Set
 Set of valid characters in a programming language

 Processing of characters
 Identifying vowels
 Counting the number of vowels
 Sorting in alphabetical order

 Encoding
 Representing a character using a unique string of bits
 English alphabets : 26
 Number of bits required : 5 (25 = 32)

Bit String Letter Bit String Letter Bit String Letter


00000 A 01001 J 10010 S
00001 B 01010 K 10011 T
00010 C 01011 L 10100 U
00011 D 01100 M 10101 V
00100 E 01101 N 10110 W
00101 F 01110 O 10111 X
00110 G 01111 P 11000 Y
00111 H 10000 Q 11001 Z
01000 I 10001 R
 ASCII Encoding
 American Standard Code for Information Interchange
 7 bit and 8 bit codes

 ISCII
 Indian Standard Code for Information Interchange
 8 bits

 Unicode
 16 bits
Least Significant bits Most Significant Bits
b 3 b2 b1 b0 b6 b5 b 4

000 001 010 011 100 101 110 111


0000 NUL DLE SPACE 0 @ P p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 “ 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EOT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ‘ 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS ‘ < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
 Represent Sunflower in 7-bit ASCII code

1010011 1110101 1101110 1100110 1101100 1101111 1110111 1100101 1110010

 The license number of a car is TN74C5425. Represent it using 7-bit ASCII code.

101010010011100110111011010010000110110101011010001100100110101
Error detecting codes

 Errors may occur in recording data on magnetic surfaces due to bad spots in the surface
 Errors may also be caused by electrical disturbances during data transmission between
units.
 Parity check bit – Detects single bit errors
 Odd parity check bits and Even parity check bits
 Parity check bit is appended to the 7 bit code in such a way that the total number of 1s in
each character code is even. (Even)
 Ex.
E – 1000101 - 10001011
A – 1000001 - 10000010

 Error correcting codes


Part A & B Questions
 Name the input devices used to acquire numeric and text data.
 How does a character reader work?
 What is the purpose of MICR?
 What is the use of bar code scanner?
 What are the ways in which you can convert characters into binary values?
Essay Questions
 Explain the processes used to convert numeric data into binary.
 Convert ---------- to binary (Decimal to binary)
 Convert ----.---- to binary (Decimal to binary)
 Convert --------- to decimal. (Binary to decimal)
 Convert ----------.----- to decimal. (Binary to decimal)
 Convert ---------- to binary using binary encoding.
 Convert ---------. ----- to binary (Hexadecimal to binary)

You might also like