Answer the following statements true (T) or false (F)
1. The following definition of the structure variables of type myStruct s and t could be made using several definitions using the structure tag.
```
struct myStruct
{
int i;
double d;
} s, t;
```
2. A structure can have a member whose type is another structure.
3. Consider these hierarchical structures.
```
struct Date
{
int year;
//members
};
struct Person
{
Date birthDay;
//other members
};
Person Bill;
The year of Bill’s birthday may be accessed as Bill.year;
```
4. No special syntax is necessary to define a function that uses a structure parameter. (This is unlike using an array parameter.)
5. There is no aggregate initialization available for structure variables. You must declare structure variables then use assignment to initialize the members.
1. True
This possibility is why the semicolon is necessary at the end of a structure definition. Here is how the definitions may be rewritten.
```
struct myStruct
{
int i;
double d;
};
myStruct s;
myStruct t;
```
2. True
Structures collect, name and give a type to related data. A subcollection of data from a structure may be so closely related that we want to make a struct of the subcollection. Example: A struct containing personal data may contain a birth date of struct type, in turn composed of day, month and year.
3. False.
To access the year of Bill’s birthday one must specify the Person’s Date structure variable, as Bill.birthDay.year.
4. True
Once the structure definition has been made, a structure tag is a type that may be used in any way that a built-in type such as int or double can be used. For example, given the structure definition
```
struct S {/*…*/};
```
here is a definition of the void function func that has an S structure parameter.
```
void func(S y);
```
This is unlike using an array parameter, which requires square brackets, as well as an additional size parameter, such as
```
void bar(Y[] x, int size);
```
5. False
A struct can be initialized by using a sequenced of initializers very much like arrays.
```
struct A { int a; int b; double d;}; A x = { 1, 2, 3.0};
```
You might also like to view...
Email messages can be formatted as HTML, Plain Text, or Rich Text.
Answer the following statement true (T) or false (F)
The only controls that typically do not have access keys assigned to them in Windows applications are ___________.
A. Exit and Cancel B. OK and Exit C. OK and Next D. OK and Cancel
Incorporating InfoSec components into periodic employee performance evaluations can __________.
A. heighten InfoSec awareness B. frighten employees C. demotivate workers D. reduce compliance to policy
Which of the following statements will read an entire line of input into the string object, address?
a. cin << address; b. cin address; c. cin.get(address); d. getline(cin, address); e. cin.get(length >> width >> height);