P3 – explain sequence, selection and iteration as used in computer programming
P4 – outline the benefits of having a variety of data types available to the programmer
In your role of Development Consultant at SNC PLC, your line manager Jane Fletcher has asked you to expand the information contained in the wiki you made for her previously to include some additional data.
1. Taking the data types outlined on page 3 of this document, for each give an explanation of what each type may be used for, and what data can be validly contained within a variable for each type. (Background for P4)
Text; integer; floating point; byte; date; Boolean; other eg char, smallint
When making a program there are many different data types that are used for different types of data. Some of the main data types are String, Integer, Floating point, byte, date, Boolean and others are char and smallint. For each of these examples I will be telling you what they are used for and which types of data can be validly contained within them.
The data type String will normally be a sequence of characters that either literal constant or as some kind of variable. So sequences of unsigned 16-bit code points from the value 0 to 65525 can be held in this data type.
Integer, this data type will be able to hold 32-bit signed integers which range from the values -2,147,483,648 to 2, 147,483,647. It is a data type that provides an optimal performance on a 32-bit processor. The default value of integer is a 0.
Floating Point has data types, single and double. The single type will need 4 bytes of memory; it is able to store negative and positive values between. The negative values are will be between -3.402823 x 1038 and -1.401298 x 10-45 and the positive values are between 1.401298 x 10-45 and 3.402823 x 1038.
The double data type needs a bigger memory of 8 bytes but can store much more values in the positive and negative values.
The data type byte is used for containing...