Chapter 3 Data Representation - PowerPoint PPT Presentation

1 / 64
About This Presentation
Title:

Chapter 3 Data Representation

Description:

... multiple digits to form a single data value to represent large numbers. ... numbering system: ... be very large or very small, but not both at the same time ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 65
Provided by: jackw7
Category:

less

Transcript and Presenter's Notes

Title: Chapter 3 Data Representation


1
Chapter 3Data Representation
2
Chapter Goals
Systems Architecture
Chapter 3
  • Describe numbering systems and their use in data
    representation
  • Compare and contrast various data representation
    methods
  • Describe how nonnumeric data is represented
  • Describe common data structures and their uses

3
Data Representation
Systems Architecture
Chapter 3
  • Data can be Represented in a variety of forms.
  • Arabic numerals
  • Roman numerals
  • Lines or tick marks
  • Pictorial characters
  • Alphabetic characters
  • Sound Waves

4
Binary Representation of Data
Systems Architecture
Chapter 3
  • Computers represent data using binary numbers.
  • Binary numbers correspond directly with values in
    boolean logic.
  • Computers combine multiple digits to form a
    single data value to represent large numbers.

5
Number systems
Chapter 3
Systems Architecture
  • The number of symbols in the number system is
    equal to the base of the number system.
  • There are 10 symbols in the decimal number
    system. (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
  • There are 2 symbols in the binary number system.
    (0, 1)

6
Data Representation
Systems Architecture
Chapter 3
  • The symbol used to represent a digit and digit
    position within a string determine its value.
  • For Example
  • (5 x 1000) (6 x 100) (8 x 10) 9
  • 5,000 600 80 9
    5,689

7
Number systems
Systems Architecture
Chapter 3
  • The fractional part of a numeric value is
    separated from the whole number by a period
    (radix point).
  • For Example 5,689.368
  • (3 x .1) (6 x .01) (8 x .001)
  • 0.3 0.06 0.008 0.368

8
Binary Data Representation
Systems Architecture
Chapter 3
  • In the binary numbering system
  • The first position to the right of the radix
    point represents halves ( 2-1)
  • The second position to the right of the radix
    point represents quarters (2-2)
  • The third position to the right of the radix
    point represents eights (2-3)

9
Binary Data Representation
Systems Architecture
Chapter 3
10
Binary Data Representation
Chapter 3
Systems Architecture
11
Binary Data Representation
Chapter 3
Systems Architecture
12
Hexadecimal Notation
Chapter 3
Systems Architecture
  • The base(radix) of a hexadecimal number system is
    16.
  • There are 16 characters in the hexadecimal number
    system.
  • There are only 10 characters in the Arabic number
    system that can be used to represent some of the
    16 characters in the hexadecimal number system.
  • The letters A, B, C, D, E, F are used to
    represent the last 6 characters in the
    hexadecimal number system.

13
Hexadecimal Notation
Systems Architecture
Chapter 3
14
Octal Notation
Chapter 3
Systems Architecture
  • Some operating systems and machine language
    programs use octal notation.
  • The base(radix) of an Octal number system is 8.
  • There are 8 characters in the octal number
    system. (0, 1, 2, 3, 4, 5, 6, 7)

15
Goals of Computer Data Representation
Systems Architecture
Chapter 3
  • Any representation format for numeric data
    represents a balance among several factors,
    including
  • Compactness
  • Accuracy
  • Range
  • Ease of manipulation
  • Standardization

16
CPU Data Types
Chapter 3
Systems Architecture
  • Five Elementary Data Types
  • Integer
  • Excess Notation (using - signs)
  • Twos Complement Notation
  • Real number
  • Floating Point Notation
  • Character
  • Boolean
  • Memory address

17
CPU Data Types
Chapter 3
Systems Architecture
  • Excess Notation
  • Excess notation is used to represent signed
    integers
  • A fixed number of bits is used to represent the
    number
  • The leftmost digit represents the sign
  • The leftmost digit is 1 for positive values
  • The leftmost digit is 0 for negative values

18
CPU Data Types
Chapter 3
Systems Architecture
19
CPU Data Types
Chapter 3
Systems Architecture
  • Twos Complement Notation
  • Nonnegative integer values are represented as
    ordinary binary numbers
  • Negative integer values are represented using
    (Complement of positive value 1)
  • The complement of a number is formed by changing
    all 1 bits to 0 and all 0 bits to 1

20
CPU Data Types
Systems Architecture
Chapter 3
  • Twos Complement Notation
  • For Example
  • Decimal number -710
  • Binary representation 01112
  • Twos Complement 10002
  • Add one 00012
  • 10012 (-710)

21
CPU Data Types
Chapter 3
Systems Architecture
  • Twos Complement Notation
  • The leftmost bit represents the sign
  • A fixed number of bit positions are used
  • Only two logic circuits are required to perform
    addition on single-bit values
  • Subtraction can be performed as addition of a
    negative value

22
CPU Data Types
Chapter 3
Systems Architecture
  • Range and Overflow
  • Most modern CPUs use either 32 or 64 bits to
    represent a twos complement value
  • The numeric range of a twos complement value is
    (2 n-1) t o (2 n-1-1)
  • For example the range for a 32 bit number is
    -2 31 to 2 31 - 1

23
CPU Data Types
Systems Architecture
Chapter 3
  • Range and Overflow
  • If data is too large to store in the 32 or 64
    bits, then overflow occurs
  • Overflow is treated as an error by the CPU
  • To avoid overflow some computers and programming
    languages define additional data types as double
    precision (long integer)

24
CPU Data Types
Chapter 3
Systems Architecture
  • Real Numbers
  • A real number can contain both whole and
    fractional components
  • The whole portion appears to the left of the
    radix point
  • The fractional portion appears to the right of
    the radix point

25
CPU Data Types
Chapter 3
Systems Architecture
  • Real Numbers
  • For Example
  • 18.56 (18 whole portion)
  • (.56 fractional portion)

26
CPU Data Types
Chapter 3
Systems Architecture
27
CPU Data Types
Systems Architecture
Chapter 3
  • Floating Point Notation
  • Floating point notation is used to represent very
    small numbers and very large numbers
  • Values can either be very large or very small,
    but not both at the same time

28
CPU Data Types
Systems Architecture
Chapter 3
29
CPU Data Types
Chapter 3
Systems Architecture
  • Range, Overflow and Underflow
  • The number of bits in the string represent the
    range of values
  • Number of bits in the mantissa
  • Number of bits in the exponent

30
CPU Data Types
Chapter 3
Systems Architecture
31
CPU Data Types
Chapter 3
Systems Architecture
  • Range, Overflow and Underflow
  • Overflow occurs when the exponent is larger than
    the allocated space.
  • Underflow occurs when a negative exponent is too
    large in absolute value to fit within the bits
    allocated to store it.

32
CPU Data Types
Systems Architecture
Chapter 3
  • Precision accuracy is reduced as the number of
    digits available to store the mantissa is
    reduced.
  • Truncation if the number of digits in the
    mantissa is larger than the allocated space,the
    number of digits in the mantissa is truncated.

33
CPU Data Types
Systems Architecture
Chapter 3
  • Character Data
  • An individual symbol is a character.
  • Characters grouped together form a string.
  • Character data can only be represented in the
    computer system using a coding scheme.

34
CPU Data Types
Chapter 3
Systems Architecture
  • Character Data
  • Coding Scheme Characteristics
  • The specific coding method represents a tradeoff
    among compactness, ease of manipulation,
    accuracy, range and standardization.

35
CPU Data Types
Chapter 3
Systems Architecture
  • BCD
  • Binary Coded Decimal (BCD)
  • Character coding method used by early IBM
    mainframe computers.
  • Characters are encoded as strings of six bits.
  • 64 - (26) symbols are represented.

36
CPU Data Types
Chapter 3
Systems Architecture
  • EBCDIC
  • Extended Binary Coded Decimal Interchange
    Code
  • 8 bit coding method used by IBM mainframe
    computers.
  • Characters are encoded as strings of eight bits.
  • 256 - (28) symbols are represented.

37
CPU Data Types
Chapter 3
Systems Architecture
  • ASCII
  • American Standard Code of Information
    Interchange
  • Coding method used in data communication that has
    been adopted by the United States.
  • 7-bit and 8-bit formats
  • Includes device control codes

38
CPU Data Types
Chapter 3
Systems Architecture
39
CPU Data Types
Chapter 3
Systems Architecture
  • Unicode
  • Multilingual character encoding standard
    encompassing all of the worlds written
    languages.
  • Characters are coded using 16 bit strings.
  • 65,535 (216) characters are represented.

40
CPU Data Types
Chapter 3
Systems Architecture
  • Boolean Data
  • Two data values true and false.
  • Data is represented using a single bit.
  • Binary 1 can represent true and binary 0 can
    represent false.

41
CPU Data Types
Systems Architecture
Chapter 3
  • Memory Addresses
  • Flat memory model
  • Memory addresses can be represented using a
    single integer.
  • Segmented memory model
  • Memory addresses require multiple integers.

42
Data Structures
Systems Architecture
Chapter 3
  • A data structure is a related group of
    elementary data elements that is organized for
    some type of processing.
  • Data structures are defined and manipulated
    within software.

43
Data Structures
Chapter 3
Systems Architecture
  • Virtually all data structures make extensive
    use of pointers and addresses.
  • Pointer a data element that contains the
    address of another data element.
  • Address the location of some data element
    within a storage device.

44
Arrays and Lists
Chapter 3
Systems Architecture
  • An array is an ordered list in which each
    element can be referenced by an index to its
    position.

45
Arrays and Lists
Chapter 3
Systems Architecture
46
Arrays and Lists
Systems Architecture
Chapter 3
47
Arrays and Linked Lists
Chapter 3
Systems Architecture
  • Linked List
  • A linked list is a data structure that uses
    pointer so list elements can be scattered among
    nonsequential storage locations.

48
Arrays and Linked Lists
Chapter 3
Systems Architecture
  • Linked List
  • In a singly linked list each element occupies
    two storage locations
  • Data value of a list element
  • Address of the next element value

49
Arrays and Linked Lists
Chapter 3
Systems Architecture

50
Arrays and Lists
Chapter 3
Systems Architecture
51
Arrays and Lists
Systems Architecture
Chapter 3
  • The procedure to add a new element
  • Allocate storage for the new element.
  • Copy the pointer from the element preceding the
    new element into the pointer field of the new
    element.
  • Write the address of the new element into the
    pointer field of the preceding element.

52
Arrays and Lists
Chapter 3
Systems Architecture
53
Arrays and Lists
Chapter 3
Systems Architecture
54
Arrays and Lists
Systems Architecture
Chapter 3
  • A doubly linked list
  • Each element has two pointers
  • One pointer points to the next element in the
    list
  • One pointer points to the previous element in the
    list

55
Arrays and Lists
Systems Architecture
Chapter 3
  • Doubly linked list
  • Advantage
  • The list can be traversed in any order
  • Disadvantage
  • More pointers must be updated each time an
    element is inserted or deleted
  • More storage locations are required to hold the
    extra set of pointers

56
Arrays and Lists
Systems Architecture
Chapter 3
57
Records and Files
Systems Architecture
Chapter 3
  • A record is a data structure composed of other
    data structures or elementary data elements.
  • Records are used as a unit of input and output to
    files or databases.

58
Records and Files
Systems Architecture
Chapter 3
59
Records and Files
Systems Architecture
Chapter 3
  • A sequence of records on secondary storage is
    called a file.
  • A sequence of records stored within main memory
    is called a table.
  • Sequential files suffer the same problems as
    contiguous arrays when inserting and deleting
    records.
  • To eliminate this problem, linked lists and
    indexed files are used.

60
Records and Files
Systems Architecture
Chapter 3
61
Classes and Objects
Chapter 3
Systems Architecture
  • An alternative view of computer and software
    behavior has been developed.
  • This view involves classes and objects.
  • A class is a data structure that contains both
    data elements and programs that manipulate that
    data.
  • The programs in a class are methods.
  • An object is one instance or variable of the
    class.

62
Classes and Objects
Systems Architecture
Chapter 3
63
Summary
Systems Architecture
Chapter 3
  • To be processed by any device, data must be
    converted from its native format into a form
    suitable for the processing device.
  • All data, including nonnumeric data, are
    represented within a modern computer system as
    strings of binary digits, or bits.
  • Each bit string has a specific data format and
    coding method.

64
Summary
Chapter 3
Systems Architecture
  • Numeric data is stored using integer, real
    number, and floating point formats.
  • Characters are converted to numbers by means of a
    coding table.
  • Boolean values can have only two values, true and
    false.
  • Programs often need to define and manipulate data
    in larger and more complex units than elementary
    CPU data types.
Write a Comment
User Comments (0)
About PowerShow.com