Quiz 4 - Structured Data
True/False: An anonymous union declaration actually creates the member variables in memory.
True
True/False: Any mathematical operations that can be performed on regular C++ variables can be performed on structure members.
True
True/False: If a function is legally prototyped to return an integer value, it can return a structure member that is an integer data type.
True
A declaration for an enumerated type begins with the ________ key word.
enum
Look at the following declaration. enum Tree { OAK, MAPLE, PINE }; What is the value of the following relational expression?
false
This is required after the closing brace of the structure declaration.
semicolon
Look at the following structure declaration. struct Circle { double centerX; double centerY; double center radius; }; Assume that circle1 and circle2 are variables of the Circle type, and their members have been initialized.True/False: The following if statement correctly determines whether the two variables' members contain the same data: if (circle1 = circle2)
False
True/False: It is possible to output the contents of all members of a structure variable using a cout << statement followed by the name of the structure variable.
False
True/False: The names of the enumerators in an enumerated data type must be enclosed in quotation marks.
False
True/False: In C++ 11, if you want to retrieve a strongly typed enumerator's underlying integer value, you must use a cast operator.
True
True/False: It is possible for a structure to contain as a member a pointer to its own structure type.
True
True/False: The structure pointer operator is used to dereference a pointer to a structure, not a pointer that is a member of a structure.
True
True/False: You cannot directly assign an integer value to an enum variable.
True
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)
When a structure is passed ________ to a function, its members are not copied.
by reference
If an anonymous union is declared globally (outside all functions), it must be ________.
declared static
If Circle is a structure, the statement: Circle *pcirc = nullptr;
declares a structure pointer called pcirc initialized with a null pointer
With an enumerated data type, the enumerators are stored in memory as ________.
integers
A function ________ return a structure.
may
In C++ 11 you can use a new type of enum, known as a(n) ________, (also known as an enum class) to have multiple enumerators with the same name, within the same scope.
strongly typed enum
A structure pointer contains ________.
the address of a structure variable
A good reason to pass a structure as a constant reference is ________.
to prevent changes to the structure members
This is like a structure, except all members occupy the same memory area.
union
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]