Data Representation and Data Types

Data Representation and Data Types

Data Types

Data types are classifications of data which tell the computer how the programmer intends to use the data.

  • Integer: This is a data type that represents whole numbers, and can be either positive or negative.

  • Real (or floating point): This data type represents numbers that have decimals.

  • Character: This data type is used to represent a single character, such as a letter, number, or symbol.

  • String: A string is a data type that is used to represent text or a series of characters.

  • Boolean: This is a data type that can have one of two values: true or false. It’s primarily used for conditional testing.

Binary System

The binary system is a number system that uses base 2 and includes only two numbers, 0 and 1.

  • Bit: This is the most basic unit of information in computing and digital communications. It represents the binary values 0 or 1.

  • Byte: This is composed of 8 bits.

  • Binary Addition: Addition in the binary system follows the same rules as those in the decimal system, but it only uses 0 and 1.

Binary to Denary Conversion

  • To convert from binary to denary, from right to left, multiply each bit by 2 raised to the power of its position, starting count from 0. Sum these values to get the denary equivalent.

Denary to Binary Conversion

  • To convert from denary to binary, divide the denary number by 2 and record the remainder. Repeat this process until the denary number is 0. The binary equivalent is the recorded remainders read in reverse order.

Data Representation

Data representation is the method used to represent information in a computer with the help of symbols and characters.

  • ASCII (American Standard Code for Information Interchange): This is a standardized character encoding used by computers to represent text.

  • Unicode: This is an expanded version of ASCII that includes special and non-roman characters.

Image and Sound Representation

  • Bitmaps: Bitmaps are used to store information about the color of each pixel within an image.

  • Vectors: Vector images are represented using equations and can be easily resized without losing quality.

  • Sound files: Sound is represented digitally through a process called sampling. The sound wave is measured at regular intervals and the amplitude of the wave is recorded.