The components of a struct are called the ____ of the struct.
answer
members
question
Consider the following struct definition
struct rectangleData
{
double length;
double width;
double area;
double perimeter;
};
Which of the following variable declarations is correct?
a. rectangleData rectangle = new rectangleData();
b. rectangle rectangleData;
c. struct rectangleData();
d. rectangleData myRectangle;
answer
rectangleData myRectangle;
question
Typically, in a program, a struct is defined ____ in the program.
answer
before the definitions of all the functions
question
An array name and index are separated using ____.
answer
square brackets
question
The syntax for accessing a struct member is structVariableName____.
answer
.memberName
question
In C++, the ____ symbol is an operator, called the member access operator.
answer
.(dot)
question
Consider the following statements.
struct rectangleData
{
double length;
double width;
double area;
double perimeter;
};
rectangleData bigRect;
Which of the following statements is valid in C++?
a. cin >> bigRect.length >> width;
b. cout << bigRect.length;
c. cout << bigRect;
d. cout << length;
answer
b. cout << bigRect.length;
question
Consider the following statements.
struct personalInfo
{
string name;
int age;
double height;
double weight;
};
struct commonInfo
{
string name;
int age;
};
personalInfo person1, person2;
commonInfo person3, person4;
Which of the following statements is valid in C++?
a. person1 = person3;
b. person2 = person1;
c. person2 = person3;
d. person2 = person4;
answer
b. person2 = person1;
question
You can assign the value of one struct variable to another struct variable of ____ type.
answer
c. the same
Haven't found what you need?
Search for quizzes and test answers now
Quizzes.studymoose.com uses cookies. By continuing you agree to our cookie policy