Chapter 9 Flashcards
True or False:
You can declare struct variables when you define a struct
True
True or False:
In structs, you access a component by using the struct name together with the relative position of the component
False
True or False:
To access a structure member (component), you use the struct variable name together with the member name; these names are separated by a period.
True
True or False:
You can use an assignment statement to copy the contents of one struct to another struct of the same type
True
True or False:
Relational operations can be used on struct variables
False
True or False:
Data in a struct variable must be read one member at a time
True
True or False:
A function can return a value of the type array
False
True or False:
A function can return a value of the type struct
True
True or False:
Aggregate input/output operations are allowed on a struct variable
False
A struct is typically a _______ data structure
heterogeneous
The components of a struct are called the ___________ of the struct
members
Which of the following struct definitions is correct in C++
struct studentType
{
int ID;
};
Consider the following struct definition:
struct rectangleData
{
double length;
double width;
double area;
double perimeter;
};
which of the following variable declarations is correct
rectangleData myRectangle;
Typically, in a program, a struct is defined ________ in the program
before the definitions of all the functions
An array name and index are separated using
square brackets
The syntax for accessing a struct member is structVariableName_________
.memberName