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).
You might also like to view...
When adding a button-activated macro to the Quick Access Toolbar, you can assign a(n) ________ in the Modify Button dialog box
Fill in the blank(s) with correct word
Using SSL and VPN to establish a secure communication channel is covered in which of the following CBK domain?
A. Cryptography B. Telecommunications and network security C. Operations security D. Security architecture and design