Answer the following statements true (T) or false (F)
1. A for-loop is a convenient way to step through an array.
2. A C++ structure, or struct, like the C++ array, is a homogeneous data structure. (i.e.,
all data is of the same type)
3. Structure definitions are usually global (defined outside any functions).
4. A structure member is access using the index operator [ ], with the member name as
index. [ ]
5. A structure variable can be defined directly in the same statement that defines a structure definition.
1. True
The for-loop provides convenient places for definition and initialization,
testing, and updating a loop control variable. This variable is convenient to use as an
array index in stepping through the array, as:
```
for(int i = 0; i < declared_size; i++)
cout << array[i} << " ";
cout << endl;
```
2.False
The struct provides a mechanism to define a collection of values that may
be of several different types.
3.True
A structure definition is a type that, like const definitions, we usually
want to be available everywhere in a program that follows the structure definition.
4. False
Access to structure members is made by giving the structure tag,
followed by a dot followed by the member name.
Example: Given the structure definition and variable definition such as
```
struct CDAccount
{
double balance,
double interestRate;
int term;
};
CDAccount account1;
```
Access to member variables of account1 may be had using the dot operator:
account1.balance1
account1.interestRate
5. True
The variables s and t are structure variables of structure type myStruct under the following definitions:
```
struct myStruct
{
int i;
double d;
} s, t;
```
You might also like to view...
What is the significance of the line?
``` LI EM { color: red; font-weight: bold } ``` a) It will apply the specified style to text enclosed by either LI or EM tags. b) It will apply the specified style to text enclosed by the EM tags which are within LI tags. c) It will apply the specified styel to text enclosed by the LI tags which are within EM tags d) It will apply the specified style to text not enclosed by either LI or EM tags.
On a Windows Server 2012 network, which network protocol cannot be routed?
A. TCP B. NetBEUI C. SNA D. IP