Sunteți pe pagina 1din 4

Data types

Variables are stored in RAM but it is necessary to let the program know the type of data that
each variable will hold.

Sample
Data type Description
data

INTEGER Stores positive or negative whole numbers 17

Stores numbers that contain decimal places/values and can also store
REAL 17.65
integers

CHARACTER Stores a single character which can be a letter, number or symbol $

Stores alphanumeric combinations and text. String is really a group of


characters stored together as one. Numbers to be used for calculations
STRING Bitesize
should not be stored as string data even though they can be. They
should be stored as INTEGER or REAL

Stores True or False only. This is sometimes taught as 1 or 0 only


BOOLEAN True
where 1 is true and 0 false

Data Type Description Storage Size

Numbers Integer 2 or 4 bytes


Number
Number Real 4 bytes

Date/Time Date and/or time 8 bytes


Yes/No, True/False, On/Off (two 1 byte
Boolean
options only)

Text (String ) Fixed String 2 or 4 bytes

Text/ String Variable String

Autonumber Automaticly generated number 4 bytes

A number formatted to a currency 8 bytes


Currency
of choice

Char Contains only a single letter 1 byte

Example Question:

Q1. A picture gallery owner has decided to set up a database to keep information about the

pictures he has for sale. The database table, PICTURE, will contain the following fields:

Title; Artist; Description; Catalogue Number; Size (area in square centimeters); Price;

Arrived (date picture arrived at gallery); Sold (whether picture is already sold)

(a) (i) State what data type you would choose for each field.

Title: ..............................................................................................................

Artist: ...........................................................................................................

Description: ..................................................................................................
Catalogue Number: .......................................................................................

Size: .......................................................................................................

Price: ..........................................................................................................

Arrived: .........................................................................................................

Sold: ........................................................................................................[4]

June 2019 Paper 21

Q2. Describe each of the following data types used in programming. In each case, give an example of

a piece of data to illustrate your answer. Each example must be different.

Char

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

String

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

Boolean

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................[6]

June 2017

Q3. For a variable that you have used to record information about the cost of the outing in

Task 1, state the name, data type and its use.

Variable name ....................................................................................................................

Data type ............................................................................................................................


Use .....................................................................................................................................[3]

Q4.. Complete the table below to show which data type would be best suited for some of the fields that
you used in question .

Use the following field names:

• Minimum Quantity

• Registration Number

• Date of Birth

• Colour

• Payroll Number

Field name Data type

S-ar putea să vă placă și