answers already passed 2025
8.1 Can you store a mixture of data types in an array? - correct answer Arrays
are specifically designed for storing and processing lists of data. Like a
variable, an array is a named storage location in memory. Unlike a variable,
an array can hold a group of values. All of the values in an array must be the
same data type. You can have an array of Integers, an array of Reals, or an
array of Strings, but you cannot store a mixture of data types in an array.
8.1 What is an array size declarator? - correct answer Declare Integer
units[10]
Notice that this statement looks like a regular Integer variable declaration
except for the number inside the brackets. The number inside the brackets,
called a size declarator, specifies the number of values that the array can
hold. This pseudocode statement declares an array named units that can hold
10 integer values. In most programming languages, an array size declarator
must be a nonnegative integer.
Declare Real salesAmounts[7]
This statement declares an array named salesAmounts that can hold 7 real
numbers.
Declare String names[50]
This statement declares an array that can hold 50 strings. The name of the
array is names.
, 8.1 In most languages, can the size of an array be changed while the program
is running? - correct answer In most languages, an array's size cannot be
changed while the program is running. If you have written a program that uses
an array and then find that you must change the array's size, you have to
change the array's size declarator in the source code. Then you must
recompile the program (or rerun the program if you are using an interpreted
language) with the new size declarator. To make array sizes easier to
maintain, many programmers prefer to use named constants as array size
declarators.
Constant Integer SIZE = 10
Declare Integer units[SIZE]
Many array processing techniques require you to refer to the array's size.
When you use a named constant as an array's size declarator, you can use
the constant to refer to the size of the array in your algorithms. If you ever
need to modify the program so the array is a different size, you need only to
change the value of the named constant.
8.1 What is an array element? - correct answer The storage locations in an
array are known as elements. In memory, an array's elements are usually
located in consecutive memory locations. Each element in an array is
assigned a unique number known as a subscript.
Constant Integer SIZE = 5 Declare Integer numbers[SIZE]
The numbers array has five elements. The elements are assigned the
subscripts 0 through 4.
8.1 What is a subscript? - correct answer (Subscripts are also known as
indexes.) Subscripts are used to identify specific elements in an array. In most