Answer the following statements true (T) or false (F)

1. To call a function with an array parameter, write the array argument as the array name
followed by empty square brackets, as in f(a[], 7); (The first argument is an array a,
the second is the size.)
2. Consider the array declaration, int x[20];. There is no memory allocated for
x[20].
3. Arrays in C++ may have several different types stored in them.
4. Given the two C++ array declarations:
int a[10], b[10];
You can successfully compute one array, say a, then assign b to a:
a = b;
5. In the sequential search algorithm, items are examined alternately, odd then evens, in
order to find whether the target value is in the array (and if the target is present, to the
index of the target.)


1. False
The correct syntax is to put the naked array name in the argument slot
for the array parameter. If this were the function declaration,
```
void f(int x[],int size);
```
the call would look like
```
f(array_name, array_size);
```
2. True
There is memory allocated for x[0] through x[19] but not for x[20]:
3. False
The array must be declared using the name of the type that will be
stored in them. Nothing else can be stored in that array. An attempt to store
something else will result in an attempt by C++ to coerce the other type to the base
type, but that is as far as you can go in putting another type into a C++ array.
4. False
You cannot assign arrays in C++. Some compilers allow this, but the
Standard says this is illegal, and most compilers do not allow it. To do this you need
to write a loop or otherwise copy individual indexed variables.
5. False.
The sequential search algorithm performs just as the name suggests: The
elements are searched in sequential order, until the target is found (success) or the end
of the array is found (failure).

Computer Science & Information Technology

You might also like to view...

Select the false statement regarding inheritance.

a. A derived class can contain more attributes and behaviors than its base class. b. A derived class can be the base class for other derived classes. c. Some derived classes can have multiple base classes. d. Base classes are usually more specific than derived classes.

Computer Science & Information Technology

Show the output of the following program:

``` #include using namespace std; void f(int n) { if (n > 0) { cout << n % 10; f(n / 10); } } int main() { f(1234567); return 0; ```

Computer Science & Information Technology

The values that limit the displayed records to match specified conditions are ________

A) criteria B) data values C) delimiters D) fields

Computer Science & Information Technology

To avoid losing your work, you must save your files before exiting a program or shutting down your computer

Indicate whether the statement is true or false

Computer Science & Information Technology