0% found this document useful (0 votes)
14 views3 pages

Pre-Post Test Unit 10

Uploaded by

dr.mahmoodabd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Pre-Post Test Unit 10

Uploaded by

dr.mahmoodabd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Unit 10

Glossary
Data Structure:
Data are stored in the computer in a logical way in order to find values as
quickly as possible. The way data are stored is called the structure of the data,
hence the term data structures. The only data structure you have used so far in
this text is the single variable. Using this data structure, a single value is stored
in a single named location. This is the simplest of all data structures. Another
type of data structure is the array.

Array:
Arrays are used in the problem-solving process. A programmer who has many
values of data of the same kind can store them in the computer in the form of an
array, which makes them easier to read and use. The programmer can also use
the values in one array to point to values in another array. This is the way the
computer tallies the number of times a value appears in an array. Without arrays
this task would be very difficult. A programmer uses arrays when more than one
value of a variable is used in the solution.

Dimension:
The programmer tells the computer how many memory locations to save for an
array through a special instruction or within the definitions of the data types. In
many languages this is called dimensioning the variable. The number of
memory locations to be saved is equal to or greater than the number of locations
used in the solution. If it is less than the number of locations used, an error will
result.

Dynamic Arrays:
Some languages allow dynamic arrays. When using dynamic arrays, the
programmer designates the number of array locations as a variable, which can
be expanded or contracted during the execution of the solution. Dynamic arrays
are more flexible and use less memory space than static arrays, but are usually
more time consuming during processing.

Element:
Each array memory location is called an element and is given a number or
numbers corresponding to the position of the location in the array. This number
is a reference number relative to the location of the first value of the array. The
name of the element has two parts. The first part is the variable name; the
second
part is the reference number, also called the index number, an element number
or subscript in parentheses.

Base-Zero and Base-One system:


Because computers are zero-based, for counting purposes, many programming
languages are also zero-based. This means that the first array element is
numbered zero, and not one; it is a base-zero system. In this way, the computer
adds the element number to the memory location number of the beginning box
to locate the needed value. If the language uses the base-one system, then to
identify a specific data memory location, add the element number minus one to
the beginning number.
Pre Test

1) The decision structure is used to enter data into an array.


Answer: F
2) A two dimensional array is similar to a table that has rows and columns.
Answer: T
3) A static array has a constant number of memory locations saved for its
values.
Answer: T
4) Data structures is the way data is stored for usage.
Answer: T

5) The element numbers are the same in an array that uses the base-zero
system and an array that uses base-one system.
Answer: F
6) You must use an array starting with the first element.
Answer: F

Post Test
1) An array allows the user to use multiple values for one variable name.
Answer: T
2) There are only one-dimensional and two-dimensional arrays.
Answer: F
3) When using an automatic counter loop to print an array, you must have
an incrementor for the element number.
Answer: F
4) Arrays are used:
a. When multiple values of a variable need to be saved in the
computer’s memory to be used later in the processing.
b. When a variable has more than one value.
c. Anytime when a set of numbers needs to be summed.
d. When the user does not know the number of values needed for a variable.
Answer: A
5) Two dimensional arrays are processed:
a. Through the use of nested decisions.
b. Through the use of a case structure.
c. Through the use of nested loops.
d. None of the above.
Answer: C

You might also like