Q51571 Write a note on Data Types.

Answer:

In a broad sense, a data type’ defines a set of values, and the allowable operations on those values. Almost all programming languages explicitly include the notion of data type, though different languages may use different terminology. Most programming languages also allow the programmer to define additional data types, usually by combining multiple elements of other types and defining the valid operations of the new data type.

Example: A programmer might create a new data type named “Person” that specifies that data interpreted as Person would include a name and a date of birth.

Common data types may include:

  1. Integers,
  2. Floating-point numbers (decimals), and
  3. Alphanumeric strings.

Example: In the Java programming language, the “int” type represents the set of 32-bit integers ranging in value from -2,147,483,648 to 2,147,483,647, as well as the operations that can be performed on integers, such as addition, subtraction, and multiplication. Colors, on the other hand, are represented by three bytes denoting the amounts each of red, green, and blue, and one string representing that color’s name; allowable operations include addition and subtraction, but not multiplication.

A data type can also be thought of as a constraint placed upon the interpretation of data in a type system, describing representation, interpretation and structure of values or objects stored in computer memory. The type system uses data type information to check of computer programs that access or manipulate the data.

Here are the most common data types:

char(size) Fixed-length character string. Size is specified in parenthesis. Max 255 bytes.
Varchar(size) Variable-length character string. Max size is specified in parenthesis.
number(size) Number value with a max number of column digits specified in parenthesis.
Date Date value
number(size,d) Number value with a maximum number of digits of “size” total, with a maximum number of “d” digits to the right of the decimal.
number(size,d) Number value with a maximum number of digits of “size” total, with a maximum number of “d” digits to the right of the decimal.
ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.