Computer Knowledge - Exam Oriented
1. IDENTIFIERS, ARRAYS & STRINGS (Data Processing)
IDENTIFIERS - Arrangements involving several data items are referred to as data structures. In handling data, it is usual practice to associate names or letters with data values. For example, N can stand for the number to be stored. Then N is called an identifier. If the data value associated with it is always same, it is called �constant�, and if it changes then the identifier is called variable.
ARRAYS - When we have to deal with a set of data items like examination in a class, then it is converient to arrange them in a sequence and refer than by a single identifier. For instance, marks of 8 standents could be arranged as
MARKS=(95, 82, 78, 95, 91, 90, 89, 96).
Such an arrangement in a data structure is called �array�. Individual data items in the array may be referred to separately by stating the position in the array. Thus MARKS (4) would refer to 95. The subscript 4 could be written by a variable like �I� which can be given different values.
The individual data items in an array are called elements.
Two dimensional arrays have elements arranged into rows and columns. The rows and columns may be numbered by subscripts.
STRINGS - For text handling, a sequence of characters need to be handled as a single unit of data, which is called a string. String identifiers are denoted by a letter followed by a $ sign,
e.g. A$=�RAJA�, B$=�RANI�.
The strings can be joined together and then they are said to be concatenated. For example,
C$=�RAJARANI�.
Here C$ is the concatenation of A$+B$ and A$ and B$ are called the substrings of C$.
Each character position in the string is numbered in sequence. Each substring is stated by first and last character position.
For example in string
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
A$=
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
H |
E |
|
L |
I |
K |
E |
S |
|
C |
O |
M |
P |
U |
T |
E |
R |
S |
A$ (4, 5) is L I
A$ (10, 16) is COMPUTE.
Fixed length strings have a fixed number of character places available for data storage but variable length strings provide the data with just the number of spaces it needs. Since constant space is provided for each string in fixed length strings, lot of space wastage occurs. In variable length strings, end of each string is indicated by a * mark ; resulting in saving of space.