Data Representation and Storage Grade 10 PDF
Document Details
Kearsney College
Tags
Summary
This document is a set of notes on data representation and storage, specifically targeting Grade 10 students. It covers topics such as binary representation of numbers, data types, overflow, character encoding (ASCII, Unicode), data structures, and file management. The document provides practical examples and illustrations.
Full Transcript
Data Representation And Storage Grade 10 GRADE 10 || GRADE 11 || GRADE 12 INFORMATION TECHNOLOGY Digital Representation of Numbers A byte (8 bits) is the smallest accessible item of memory and the smallest piece of data that...
Data Representation And Storage Grade 10 GRADE 10 || GRADE 11 || GRADE 12 INFORMATION TECHNOLOGY Digital Representation of Numbers A byte (8 bits) is the smallest accessible item of memory and the smallest piece of data that can be understood by a computer. Integer Types – Unsigned numbers If we had 8 bits? What’s the largest and smallest number that can be stored? The smallest numbers is: 000000002= 010 The largest number to be stored would be : 1111 11112= 25510 The formula for the largest unsigned number is: 2n-1 Integer Types – Signed Numbers If we had 8 bits? What’s the largest and smallest SIGNED number that can be stored? The last bit is used to represent the sign of the number (“+” or “-”) The largest numbers is calculated: 0111 11112= 12710 The formula for the largest unsigned number is: 2n-1-1 The smallest number for 8 bits : 1111 11112 = -12810 The formula for the smallest unsigned number is: -2n-1 Primitive Data Types in Java Overflow An error that occurs when the computer attempts to handle a number that is too large for it. Imagine overflow as numbers in dial… Consider an 4 bit unsigned number. If we tried to store a number too large (eg, any number over 15), we will get an inaccurate representation of the number. For example, if we were to store, the number 16, we would get, 0. If we tried to store 18, we would get 2 as the value for the variable. Real Types In java we can use the variable type, Float or Double to represent real numbers. To store a decimal number, we need to store four items of data: -4.56 → -0.456 x 10 89.76 → +0.8976 x 102 0.000000342 → +0.342 x 10-6 1 bit for the 10 bits for the 1 bit for the 4 bits for the sign of the number sign of the exponent number exponent Data Representation of Characters A Character is a single letter, digit or punctuation mark. ASCII (8 bit encoding system) that is used to represent characters in computers. ASCII could represent, 28 (256) different characters Data Representation of Characters Unicode: is an industry standard encoding system that is used to represent much more than the ascii characters, including right-to-left scripts. Before Unicode, there were numerous encoding systems out there but eventually a move was made to adopt a universal system to make text display the same across devices. UTF-8 : Unicode transformation format is a type of Unicode that uses multi-byte encoding. Each character can be represented from 1 to 4 bytes. This makes it backwards compatible with ASCII. Data Structures A data structure is a way of storing and organizing data in a computer so that it can be used efficiently. In programming data can be stored in RAM using primitive data types or complex data types. – Primitive types : int, double, char, boolean – Complex types/Objects: Gogga, Strings, arrays An array is a complex data type that can store multiple values of the same type. To store text (or any numbers) data permanently, we can use text files or databases. Computer File Management Computers use a hierarchal file structure and mimic filing cabinets to organize files. The highest level is usually the physical HDD/SSD (c:, d: ). The drive will have a number of immediate child folders and the folders may also have subfolders. Files live in folders. The address to a file or folders is known as a path. Eg. C:\Users\celliott\Grade10 Is a path to my Grade 10 sub-folder. Computer File Management In order for the computer to know where data is, a file management system is needed. File Allocation Table (FAT) stores the location of files and folders. The FAT is too complicated for ordinary users to understand, so OS, like Windows, uses Explorer to allow you to work with your files and folders. Computer File Management File Name consists of a name and an extension. Please give your file a meaningful names. The extension is given by the program you are using to make the file. Saving as Another Type/Version Portable Document Format (PDF) This is a file format, created by Adobe Systems and is used for representing documents. These documents have a universal format in that they are designed to be used on any hardware, software or operating system. The files are much smaller in size and this makes it great as a file type for emailing and internet download. You can export, almost any file to PDF format. Demonstration