OBJECTIVES After reading this chapter, the student should be able to:

Similar documents
Introduction to Computer Science (I1100) Data Storage

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

Chapter 4: Computer Codes. In this chapter you will learn about:

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

Basic data types. Building blocks of computation

Number Systems. Dr. Tarek A. Tutunji Philadelphia University, Jordan

Computing in the Modern World

Review of Number Systems

MACHINE LEVEL REPRESENTATION OF DATA

OCR J276 GCSE Computer Science

Digital Computers and Machine Representation of Data

Data Storage. Slides derived from those available on the web site of the book: Computer Science: An Overview, 11 th Edition, by J.

TOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion

Programming Concepts and Skills. ASCII and other codes

Objectives. Connecting with Computer Science 2

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

Digital Logic Lecture 4 Binary Codes

Chapter 2 Data Representation on Bio-molecular Computer

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Binary Codes. Dr. Mudathir A. Fagiri

CMPS 10 Introduction to Computer Science Lecture Notes

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Lecture (02) Operations on numbering systems

umber Systems bit nibble byte word binary decimal

Chapter 3 DATA REPRESENTATION

CHAPTER 2 (b) : AND CODES

Announcement. (CSC-3501) Lecture 3 (22 Jan 2008) Today, 1 st homework will be uploaded at our class website. Seung-Jong Park (Jay)

Chapter 7. Representing Information Digitally

Analogue vs. Discrete data

Numeral Systems (Part II)

Thus needs to be a consistent method of representing negative numbers in binary computer arithmetic operations.

CHAPTER 2 Number Systems

2 Number Systems 2.1. Foundations of Computer Science Cengage Learning

Chapter 9: A Closer Look at System Hardware 4

Chapter 3: Number Systems and Codes. Textbook: Petruzella, Frank D., Programmable Logic Controllers. McGraw Hill Companies Inc.

Chapter 9: A Closer Look at System Hardware

NUMERIC SYSTEMS USED IN NETWORKING

Chapter 2 Exercises and Answers

Electronic Data and Instructions

Bits and Bit Patterns

2nd Paragraph should make a point (could be an advantage or disadvantage) and explain the point fully giving an example where necessary.

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Software and Hardware

Lecture 1: What is a computer?

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

Lecture C1 Data Representation. Computing and Art : Nature, Power, and Limits CC 3.12: Fall 2007

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Chapter 2 Number Systems and Codes Dr. Xu

Teaching KS3 Computing. Session 3 Theory: More on binary and representing text Practical: Introducing IF

Digital Fundamentals

GCSE Computing. Revision Pack TWO. Data Representation Questions. Name: /113. Attempt One % Attempt Two % Attempt Three %

Java Oriented Object Programming II Files II - Binary I/O Lesson 3

Full file at

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Fundamentals of Programming (C)

CS-201 Introduction to Programming with Java

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Digital Fundamentals

Memory Addressing, Binary, and Hexadecimal Review

Digital Representation

Colour and Number Representation. From Hex to Binary and Back. Colour and Number Representation. Colour and Number Representation

Chapter 11 : Computer Science. Information Representation. Class XI ( As per CBSE Board) New Syllabus

Dec Hex Bin ORG ; ZERO. Introduction To Computing

BINARY SYSTEM. Binary system is used in digital systems because it is:

Homeschool Enrichment. The System Unit: Processing & Memory

Appendix. Bit Operators

Chapter 2. Data Representation in Computer Systems

Introduction to Informatics

Bits. Binary Digits. 0 or 1

NUMBER SYSTEMS AND CODES

THE FUNDAMENTAL DATA TYPES

Final Study Guide Arts & Communications

REPRESENTING INFORMATION:

UNIT 7A Data Representation: Numbers and Text. Digital Data

What Is It? Instruction Register Address Register Data Register

Introduction to Numbering Systems

Module 1: Information Representation I -- Number Systems

2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS).

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-278: Digital Logic Design Fall Notes - Unit 4. hundreds.

Chapter 1. Data Storage Pearson Addison-Wesley. All rights reserved

Binary Numbers. The Basics. Base 10 Number. What is a Number? = Binary Number Example. Binary Number Example

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.

5/17/2009. Digitizing Discrete Information. Ordering Symbols. Analog vs. Digital

Exercises Software Development I. 03 Data Representation. Data types, range of values, internal format, literals. October 22nd, 2014

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Computer Science 1000: Part #3. Binary Numbers

Digital Media. Daniel Fuller ITEC 2110

CSE COMPUTER USE: Fundamentals Test 1 Version D

User. Application program. Interfaces. Operating system. Hardware

Characters in C consist of any printable or nonprintable character in the computer s character set including lowercase letters, uppercase letters,

Lecture (03) Binary Codes Registers and Logic Gates

Chapter 2 Number System

Using sticks to count was a great idea for its time. And using symbols instead of real sticks was much better.

Number Systems Base r

Digital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

Binary Systems and Codes

Intermediate Programming & Design (C++) Notation

Transcription:

Data Representation

OBJECTIVES After reading this chapter, the student should be able to: Define data types. Visualize how data are stored inside a computer. Understand the differences between text, numbers, images, video, and audio. Work with hexadecimal and octal notations.

2.1 DATA TYPES

Different types of data Numbers, text, images, audio, and video are all forms of data. Computers need to process all types of data.

Note: The computer industry uses the term multimedia to define information that contains numbers, text, images, audio, and video.

2.2 DATA INSIDE THE COMPUTER

Bit pattern All data types from outside a computer are transformed into a uniform representation called a bit pattern for processing by computers. A bit is the smallest unit of data that can be stored in a computer A switch, with its two states of on and off, can represent a bit(0 or 1) A bit pattern is a sequence of bits that can represent a symbol

Examples of bit patterns Data are coded when they enter a computer and decoded when they are presented to the user 1001..111 1111..101 1111..111 1000..000 1011..001 1001..111 1111..101 1111..111 1000..000 1011..001 A bit pattern of length 8 is called a byte Byte also been used to measure the size of memory or other storage devices

2.3 REPRESENTING DATA

Representing symbols using bit patterns How many bits are needed in a bit pattern to represent a symbol in a language? Depend on how many symbols are in the set

Number of symbols and bit pattern length Number of Symbols --------------------- 2 4 8 16 128 256 65,536 Bit Pattern Length --------------------- 1 2 3 4 7 8 16

Codes Code: different sets of bit patterns have been designed to represent text symbols ASCII: popular code for symbols American Standard Code for Information Interchange EBCDIC: used in IBM mainframes Extended Binary Coded Decimal Interchange Code Unicode: 16-bit code, allow a greater number of symbols ISO: 32-bit code, allow a greater number of symbols Coding is the process of transforming data into a bit pattern

Some features of ASCII ASCII uses a 7-bit pattern: 0000000 ~ 1111111 0000000 null character; 1111111 delete character There are 31 control (nonprintable) characters The numeric characters (0~9) are coded before letters There are several special printable characters The uppercase letters (A~Z) come before the lowercase letters (a~z) The upper and lowercase characters are distinguished by only 1 bit. (A 1000001; a 1100001) There are six special characters between the upper and lowercase letters

Image representation methods

Bitmap graphic method Image is divided into a matrix of pixels (picture elements), each pixel is assigned a bit pattern The size of the pixel depends on what is called the resolution

Representation of color pixels

Vector graphic If you want to rescale the bitmap graphic image, which creates a ragged or grainy look An image is decomposed into a combination of curves and lines Each curve or line is represented by a mathematical formula Each time an image is drawn, the formula is reevaluated

Audio representation Audio data are transformed to bit patterns through sampling, quantization, and coding

Video Video is a representation of images (called frames) in time, the combination of the images represents the video A movie is a series of frames shown one after another to create the illusion of motion Today video is normally compressed: MPEG

2.4 HEXADECIMAL NOTATION

Note: A 4-bit 4 pattern can be represented by a hexadecimal digit, and vice versa.

Hexadecimal digits Bit Pattern ------------ 0000 0001 0010 0011 0100 0101 0110 0111 Hex Digit ------------ 0 1 2 3 4 5 6 7 Bit Pattern ------------ 1000 1001 1010 1011 1100 1101 1110 1111 Hex Digit ------------ 8 9 A BC D EF People find it difficult to manipulate bit patterns. Writing a long stream of 0s and 1s is tedious and prone to error

Binary to hexadecimal and Hexadecimal to binary transformation 15 12 14 4 Decimal

Example 1 Show the hexadecimal equivalent of the bit pattern 1100 1110 0010. Solution Each group of 4 bits is translated to one hexadecimal digit. The equivalent is 0xCE2.

Example 2 Show the hexadecimal equivalent of the bit pattern 0011100010. Solution Divide the bit pattern into 4-bit 4 groups (from the right). In this case, add two extra 0s at the left to make the number of bits divisible by 4. So you have 000011100010, which is translated to 0x0E2.

Example 3 What is the bit pattern for 0x24C? Solution Write each hexadecimal digit as its equivalent bit pattern to get 0010 0100 1100.

2.5 OCTAL NOTATION

Note: A 3-bit 3 pattern can be represented by an octal digit, and vice versa.

Octal digits Bit Pattern ------------ 000 001 010 011 Oct Digit ------------ 0 1 2 3 Bit Pattern ------------ 100 101 110 111 Oct Digit Oct Digit ------------ 4 5 6 7

Binary to octal and Octal to binary transformation

Example 4 Show the octal equivalent of the bit pattern 101110010. Solution Each group of 3 bits is translated to one octal digit. The equivalent is 0562, o562, or 562 8.

Example 5 Show the octal equivalent of the bit pattern 1100010. Solution Divide the bit pattern into 3-bit 3 groups (from the right). In this case, add two extra 0s at the left to make the number of bits divisible by 3. So you have 001100010, which is translated to 142 8.

Example 6 What is the bit pattern for 24 8? Solution Write each octal digit as its equivalent bit pattern to get 010100.

Example 7 What is the decimal equivalent for 24 8? Solution 2 * 8 + 4 = 20. 010100 2 = 0 * 2 5 + 1 * 2 4 + 0 * 2 3 + 1 *2 2 + 0*2 1 + 0*2 0 = 16 + 4 = 20.

HW Find out the EBCDIC code of C, S, I, E, and compare them with their ASCII codes. Find out the EBCDIC code of 0, 5, 9, and compare them with their ASCII codes. Describe the difference which you observed between the design of EBCDIC and ASCII tables.