Lesson 3
Look at the following structure declaration. Struct Employee { string name; int idNum; }; In this declaration, idNum is:
a member
Which of the following assigns a value to the hourlyWage member of employee[2]?
employee[2].hourlyWage = 100.00;
Look at the following declaration. enum Tree { OAK, MAPLE, PINE}; What is the value of the following relational expression? OAK > PINE
false
Look at the following declaration. enum Tree { OAK, MAPLE, PINE}; In memory, what value will the MAPLE enumerator be stored as?
1
This allows you to access structure members.
dot operator
Look at the following structure declaration. Struct Employee { string name; int idNum; }; In this declaration, Employee is:
a tag
Data types that are created by the programmer are known as ________.
abstract data types (ADT)
This describes only the general characteristics of an object.
abstraction
When a structure is passed ________ to a function, its members are not copied.
by reference
A structure ________ contain members of the same data type.
can
Which of the following statements outputs the value of the gpa member of element 1 of the student array?
cout << student[1].gpa;
The name of the structure is referred to as its ________.
data type argument parameter tag Correct :None of these Q
Before a structure can be used, it must be ________.
declared
If Circle is a structure, the statement: Circle *pcirc = nullptr
declares a structure pointer called pcirc initialized with a null pointer
Passing a structure as a constant reference parameter to a function ________.
guarantees not to result in changes to the structure's members
A function ________ return a structure.
may
If Circle is a structure tag, the statement: Circle doSomething(Circle c2) can be the header line for a function that ________.
takes a Circle structure as a parameter, does something, and returns a Circle structure
A good reason to pass a structure as a constant reference is ________.
to prevent changes to the structure members
Which of the following is an example of a C++ primitive data type?
unsigned short int long double unsigned char Correct : All of these
Look at the following statement. bookList[2].publisher[3] = 't'; This statement ________.
will store the character 't' in the fourth element of the publisher member of booklist[2]