chapter 2 data and information 2.1 difference between data and information 2.1 difference between...
TRANSCRIPT
Chapter 2 Chapter 2 Data and InformationData and Information
2.1 Difference between Data and Information 16
2.2 Computer Representation of Data17
2.3 Hierarchical Structure of Data23
2.4 Data Collection and Data Preparation 25
2.5 Sources of Errors26
2.6 Data Control27
2.7 Processing Data32
2.8 Processing Information37
2.9 Modes of Processing 41
2.12.1 Difference between Data and InformationDifference between Data and Information (1) (1)
Raw data (or simply data) is a collection of facts, figures and symbols raw material to be processed by a computer meaningless if you don’t know what it represents
Information is the processed data organised, meaningful and useful used in decision making
Chapter 2 Data and Information
2.12.1 Difference between Data and InformationDifference between Data and Information (2) (2)
Chapter 2 Data and Information
2.2 2.2 Computer Representation of DataComputer Representation of Data
2.2.1 Number System 2.2.2 Bits and Bytes in a Computer 2.2.3 ASCII Characters 2.2.4 Chinese Characters
Chapter 2 Data and Information
2.2.1 2.2.1 Number System (1)Number System (1)
Computer is binary machine, using digits 0 and 1 only
Binary digit Bit Each bit is either 0 or 1
2.2 Computer Rep. of Data
2.2.1 2.2.1 Number System (2)Number System (2)
A Number System consists of a set of digits The Base of a system
is the number of digits in the set The base of
binary number system is 2 decimal number system is 10 hexadecimal number system is 16
Octal (base 8) and hexadecimal (base 16) are used by programmers
2.2 Computer Rep. of Data
2.2.1 2.2.1 Number SystemNumber System (3) (3)
In hexadecimal, the decimal value of digit A is 10, B is 11 and so on
Hexadecimal digit ValueA 10B 11C 12D 13E 14F 15
2.2 Computer Rep. of Data
2.2.1 2.2.1 Number SystemNumber System (4) (4)
Consider a 4-digit number of base b:
The decimal value of the number is
2.2 Computer Rep. of Data
2.2.1 2.2.1 Number SystemNumber System (5) (5)
Conversion between Number Systems How can a decimal number be converted into other
bases, like binary? This is done by repeated division.
2.2 Computer Rep. of Data
2.2.1 2.2.1 Number SystemNumber System (6) (6)
2.2 Computer Rep. of Data
2.2.1 2.2.1 Number SystemNumber System (7) (7)
2.2 Computer Rep. of Data
2.2.1 2.2.1 Number SystemNumber System (8) (8)
2.2 Computer Rep. of Data
Hexadecimal 0 1 2 3 4 5 6 7Binary 0000 0001 0010 0011 0100 0101 0110 0111
Hexadecimal 8 9 A B C D E FBinary 1000 1001 1010 1011 1100 1101 1110 1111
Octal 0 1 2 3 4 5 6 7
Binary 000 001 010 011 100 101 110 111
2.2.1 2.2.1 Number SystemNumber System (9) (9)
Binary equivalent of octal digits is shown below:
Binary equivalent of hexadecimal digits is shown below:
2.2 Computer Rep. of Data
2.2.1 2.2.1 Number SystemNumber System (10) (10)
2.2 Computer Rep. of Data
2.2.2 2.2.2 Bits and Bytes in a ComputerBits and Bytes in a Computer (1) (1)
Byte The basic unit of storage in a computer Each byte is formed by 8 bits. Data are stored in multiple of bytes or 8 bits
2.2 Computer Rep. of Data
2.2.2 2.2.2 Bits and Bytes in a ComputerBits and Bytes in a Computer (2) (2)
Each byte can be represented by two hexadecimal digits Binary code 110(2) is stored in the computer as
2.2 Computer Rep. of Data
2.2.2 2.2.2 Bits and Bytes in a ComputerBits and Bytes in a Computer (3) (3)
Possible bit pattern in each byte varies from 0000 0000(2) to 1111 1111(2).
Range of value stored in a byte varies from 0 to 255 There are 256 different combinations in a byte
2.2 Computer Rep. of Data
2.2.3 2.2.3 ASCII CharactersASCII Characters (1) (1)
The two common types of data in a computer: Numeric Alphanumeric.
Numeric data are used for calculation Examples of alphanumeric data:
Name, address, sex
2.2 Computer Rep. of Data
2.2.3 2.2.3 ASCII CharactersASCII Characters (2) (2)
Alphanumeric data are formed by characters that include
1. letter (e.g. A, B, a, b)
2. digit (e.g. 0, 1, 2, 3)
3. symbol (e.g. %, &, #)
4. control character (e.g. end-of-file mark, a new-line character)
2.2 Computer Rep. of Data
2.2.3 2.2.3 ASCII CharactersASCII Characters (3) (3)
ASCII stands for American Standard Code for Information Interchange.
Each ASCII code is an 8-bit binary code Each character takes up one byte of storage With a maximum of 256 codes Enough for English language
2.2 Computer Rep. of Data
2.2.4 2.2.4 Chinese CharactersChinese Characters (1) (1)
More than 10,000 Chinese characters One byte is not enough to represent all Chinese
characters. Two-byte Code
Bit pattern varies from 0000(16) to FFFF(16).
Note that FFFF(16) is 10000(16) - 1.
Range: from 0 to 164 - 1 or 65535. Can represent 65536 characters.
2.2 Computer Rep. of Data
2.2.4 2.2.4 Chinese CharactersChinese Characters (2) (2)
Encoding Chinese Characters 大五碼 (Big-5) 國標碼 (Guo-Biao) 漢字碼 (Hanzi)
All use two-byte codes
2.2 Computer Rep. of Data
2.3 2.3 Hierarchical Structure of DataHierarchical Structure of Data (1) (1)
Chapter 2 Data and Information
2.3 2.3 Hierarchical Structure of DataHierarchical Structure of Data (2) (2)
Data in a database are formed by Characters Field
Combination of characters Meaningful information e.g. Name, Address and Telephone number
Chapter 2 Data and Information
2.3 2.3 Hierarchical Structure of DataHierarchical Structure of Data (3) (3)
Record Collection of fields for the same object A record stores the information of a person If there are 30 persons, there will be 30 records
Table Collection of similar records Each row represents a record Each column represents a field
Chapter 2 Data and Information
2.3 2.3 Hierarchical Structure of DataHierarchical Structure of Data (4) (4)
Database Collection of tables The database for a school library consists of tables for
StudentsBooks Loan transactions
Usually, a database is stored in a file
Chapter 2 Data and Information
2.3 2.3 Hierarchical Structure of DataHierarchical Structure of Data (5) (5)
Chapter 2 Data and Information
2.3 2.3 Hierarchical Structure of DataHierarchical Structure of Data (6) (6)
Key field (or primary key) identify records in a table Every record must have a unique key value (No two records have the same key value) Important in searching information e.g. Student ID (Why should student name not be used as key field?)
Chapter 2 Data and Information
2.4 2.4 Data Collection and Data PreparationData Collection and Data Preparation (1) (1)
Data Preparation Data should be arranged properly for easy input into a computer e.g. before marks are entered into computer, marked
scripts are arranged in order of class number
Chapter 2 Data and Information
Two methods for data input 1. Direct Input
Special input devices Without human interventions Requires little data preparation e.g. bar code on grocery item is captured by a bar code
reader 2. Manual Input
Involves a keyboard Manually entered into the computer
2.4 2.4 Data Collection and Data PreparationData Collection and Data Preparation (2) (2)
Chapter 2 Data and Information
2.5 2.5 Sources of ErrorsSources of Errors (1) (1)
Garbage In Garbage Out (GIGO) Computer will give wrong result for inaccurate/incomplete data.
1. Data source errors Data in the source document is incorrect Mainly caused by the source providers e.g. Wrong data entry (intentional or unintentional),
Omission of data or Poor handwriting
Chapter 2 Data and Information
2.5 2.5 Sources of ErrorsSources of Errors (2) (2)
2. Transcription errors Incorrectly read from the source document or Incorrectly typed through a keyboard Mainly caused by the computer operators
3. Transposition errors The information of one object is mistakenly entered
into another Serious error Caused by poor data preparation
Chapter 2 Data and Information
2.6 2.6 Data ControlData Control
2.6.1 Data Verification 2.6.2 Data Validation
Chapter 2 Data and Information
Data ControlData Control 2.6.1 2.6.1 Data VerificationData Verification (1) (1)
Data verification Checking by human Data copied from one medium to another
Method 1 Enter the same set of data twice by two different
persons. Then, the results are compared
2.6 Data Control
Data ControlData Control 2.6.1 2.6.1 Data VerificationData Verification (2) (2)
Method 2 Enter the data, produce a report Ask the source provider to verify If there are errors,
correct the errors and repeat the verification processuntil the report is completely error free
Verification by mail Report is printed and mailed to the source provider When reply is received,
address is verified automaticallyHowever, will have certain delay
2.6 Data Control
Data ControlData Control 2.6.1 2.6.1 Data VerificationData Verification (2) (2)
Method 1 Extra effort Cannot discover some errors,
e.g. Data source errors.
Method 2 More effective The verified document can be regarded as a contract
between the two parties More commonly used
e.g. Online data collections
2.6 Data Control
2.6.2 2.6.2 Data ValidationData Validation (1) (1)
Data validation Programs are used Checking against certain Rules:
1. Data Type Check
2. Range Check
3. Consistency Check
4. Completeness Check
5. Check Digit
2.6 Data Control
Data ValidationData Validation- -
2.6.2 2.6.2 Data type checkData type check
Data type check Two types of data entered through keyboard: Numeric data
Used for calculatione.g. “XYZ” is not allowed for Test Score
Alphanumeric data Numbers, letters, spaces or symbols, like "%", "@", "!" etc.e.g. “123” is not allowed for Name field
2.6.2 Data Validation
Data ValidationData Validation- -
2.6.2 2.6.2 Range checkRange check
2. Range check tests whether a data is within a given range may be applied to both numeric and alphanumeric data For example,
A test score should range from 0 to 100.A grade in public examination should range from "A" to "F” or
“U”
2.6.2 Data Validation
Data ValidationData Validation- -
2.6.22.6.2 Consistency checkConsistency check
3. Consistency check compares the data with other data to ensure logical For example,
the date of return of a book should not be earlier (smaller) than the date of loan.
(The computer compares date_in and date_out and rejects the input if date_in < date_out.)
The electric company keeps an average bill for each customer. If the current bill is very much greater than the average bill, a warning message will be shown.
2.6.2 Data Validation
Data ValidationData Validation- -
2.6.22.6.2 Completeness checkCompleteness check
4. Completeness check ensures that data is present If data is not present, the program will ask for input
again until the required data is given.
2.6.2 Data Validation
Data ValidationData Validation- -
2.6.2 2.6.2 Check digit Check digit (1)(1)
5. Check digit an extra digit at the end of a code ensure the correctness of the code can discover most of the keyboard errors,
e.g. interchanging of two characters
Examples of codes using check digits:Identity card numbersISBN for books Bar codes
2.6.2 Data Validation
Data ValidationData Validation- -
2.6.2 2.6.2 Check digit Check digit (2)(2)
Using Weighted modulo-11 to generate check digit:
1. Convert alphabets into numbers with A into 1, B into 2, and so on
2. Starting from right, give each digit a weight of 2, 3, 4, 5, ….
3. Calculate the weighted sum.
4. Divide the weighted sum by 11 and find the remainder.
5. If the remainder is 0 the check digit is 0; If the remainder is 1 the check digit is 'A’, otherwise, subtract the remainder from 11.
2.6.2 Data Validation
Data ValidationData Validation- -
2.6.2 2.6.2 Check digit Check digit (3)(3)
Using Weighted modulo-11 to validate check digit:
1. Starting from right, give each digit a weight of 1, 2, 3, 4, 5, 6, 7, 8.
2. Calculate the weighted sum.
3. The weighted sum should be divisible by 11.
2.6.2 Data Validation
2.7 2.7 Processing DataProcessing Data
2.7.1 Searching 2.7.2 Sorting 2.7.3 Merging
Chapter 2 Data and Information
Processing Data-Processing Data-
2.7.1 2.7.1 Searching (1)Searching (1)
Searching to locate a piece of information from a set of data need to provide a keyword,
which is a word or a sentence
1. Linear search
2. Binary search
3. Index search
2.7 Processing Data
Processing Data-Processing Data-
2.7.1 2.7.1 Searching Searching (2)(2)
1. Linear search Data is not well organised Search starting from the very beginning or the end Compare the data with
keyword one by one
until a match occurs orsearch fails
Used in word processing
2.7.1 Searching
Processing Data-Processing Data-
2.7.1 2.7.1 Searching Searching (3)(3)
2. Binary search Searching from organised data e.g. Searching for words in a dictionary In looking for the keyword "synergy”
Open up the dictionary at the middleIf the words start with "m”, ignore the half on the left less than
"m”Next, open up at the middle of the half on the right and compare the words with the keyword. These procedures are repeated until the keyword is found.
2.7.1 Searching
Processing Data-Processing Data-
2.7.1 2.7.1 Searching Searching (4)(4)
3. Index search Similar to using the index of a book An index is much smaller in size than the data.
Therefore, index search is very fast. Most searching in computers use index search. e.g. a
search engine of a Web site maintains an index and uses it to locate Web sites for you.
2.7.1 Searching
Processing Data-Processing Data-
2.7.2 2.7.2 Sorting Sorting (1)(1)
Sorting Arrange data in ascending or descending order of a
field. e.g. words in a dictionary are sorted in ascending order.
1. Sorting Data 2. Sorting Techniques
2.7 Processing Data
Processing Data-Processing Data-
2.7.2 2.7.2 Sorting Sorting (2)(2)
1. Sorting Data Numeric Data (Table 9) AlphaNumeric Data (Table 10)
Compare ASCII code “A” is less than “B”, and so on“Chan” is less than “Chang” ;“Ka” is less than "Kai" Digits are less than letters: "9"<"C”For letters, upper case is less than lower case "C"<"a"<"aC"<"ab"<"ba" 。Note: While 3 < 12, but "3" > "12”, it is because "3" > "1"
2.7.2 Sorting
Processing Data-Processing Data-
2.7.2 2.7.2 Sorting Sorting (3)(3)
2. Sorting technique When a computer performs sorting, it would involve
swapping of data. Swapping
interchanging the positions of two values
Bubble Sortwill have several passesIn each pass, swapping between adjacent data would take place if
the two data are not in the desired order.
2.7.2 Sorting
Processing Data-Processing Data-
2.7.3 2.7.3 MergingMerging
Merging combining two sorted lists to form a new sorted list the original two lists must be sorted in the same order
2.7 Processing Data
2.8 2.8 Processing InformationProcessing Information
2.8.1 Reorganisation 2.8.2 Conversion 2.8.3 Communication and Transmission 2.8.4 Compression 2.8.5 Parity Check
Chapter 2 Data and Information
Processing Information-Processing Information-
2.8.1 2.8.1 ReorganisationReorganisation
Information reorganisation Information that is output in one format is suitable for
one use. For instance,
1. Reorganise the students in a class of students so that girls appear before boys and the examination results appear in descending order
2. Using charts to represent information
2.8 Processing Info
Processing Information-Processing Information-
2.8.2 2.8.2 ConversionConversion
Information conversion Using a formula to generate new information For instance,
1. Calculate the average from daily and exam marks
2. Providing order of merits
2.8 Processing Info
Processing Information-Processing Information-
2.8.3 2.8.3 Communication and TransmissionCommunication and Transmission
Communication exchange of information between people Communication tools:
E-mail, videoconferencing and presentation software
Transmission passing of information between computers through a
medium The medium could be
copper wire, optical fibre or radio waves.
2.8 Processing Info
Processing Information-Processing Information-
2.8.4 2.8.4 CompressionCompression
Compression Reduce the file size Reduce the transmission time Decompressed by the receiver An example of compressed file is ZIP file
2.8 Processing Info
Processing Information-Processing Information-
2.8.5 2.8.5 Parity CheckParity Check
Parity check Ensure that data transmission is error free
Even parity check The sender adds an extra bit (binary digit) to each byte
of data to make the number of 1's in each byte even. If there is an error in transmission causing a bit to
change from 0 to 1, the receiver will find that the number of 1's is not even.
will request the sender to re-transmit the data
2.8 Processing Info
2.9 2.9 Modes of ProcessingModes of Processing
2.9.1 Batch processing 2.9.2 Real-time processing 2.9.3 Comparison
Chapter 2 Data and Information
Modes of Processing -Modes of Processing -
2.9.1 2.9.1 Batch processingBatch processing
Batch processing Data is collected into groups and processed together Information is not the most up-to-date Simple to set up and operate Examples
payrollinventory mark processing etc.
2.9 Modes of processing
Modes of Processing -Modes of Processing -
2.9.2 2.9.2 Real-time processingReal-time processing
Real-time processing Data is entered into the computer and processed as
soon as it is collected. Information is up-to-date System is more complicated Examples
In an electric power station, the amount of electrical power to be generated must meet the demand all the times.
In banking, transactions, like cash withdrawal, cash deposit or money transfer, will update the appropriate accounts immediately.
2.9 Modes of processing
Modes of Processing -Modes of Processing -
2.9.3 2.9.3 ComparisonComparison
Batch processing Real-time processing
Data correctness out-of-date up-to-dateComplexity of system low highSystem set-up cost low highResources needed low high
2.9 Modes of processing