Chapter 11

Ace your homework & exams now with Quizwiz!

The structure pointer operator is used to dereference a pointer to a structure, not a pointer that is a member of a structure.

True

You cannot directly assign an integer value to an enum variable.

True

Given the following structure declaration, idNum is struct Employee { string name; int idNum; }; a tag a member an array None of these

a member

Which of the following statements outputs the value of the gpa member of element [1] of the student array? cout << student1.gpa; cout << student1->gpa; cout << student[1].gpa; cout << firstStudent.gpa; None of these

cout << student[1].gpa;

Which of the following assigns a value to the hourlyWage member of employee[2]? employee2.hourlyWage = 7.50; employee[2] -> hourlyWage = 50.00; employee[2].hourlyWage = 75.00; hourlyWage[2].employee = 29.75; None of these

employee[2].hourlyWage = 75.00;

A declaration for an enumerated type begins with the ________ key word. enumerated enum enum_type ENUM None of these

enum

Which of the following is required after the closing brace of the structure definition? colon square bracket period semicolon None of these

semicolon

After the following statement executes, what value will the MAPLE enumerator be stored as, in memory? enum Tree { OAK, MAPLE, PINE }; 2 'M' "MAPLE" 1.0 1

1

You may use a pointer to a structure as a function return type function parameter structure member All of these None of these

All of these

A function cannot modify the members of a structure. (T/F)

False

Given the following declaration: enum Tree { OAK, MAPLE, PINE }; What is the value of the following relational expression? OAK > PINE true false This is an error. You cannot compare enumerators with relational operators.

False

Given the structure definition shown, assume that circle1 and circle2 are variables of the Circle type and their members have been initialized. struct Circle { double centerX; double centerY; double radius; }; Then, is it true or false that the following statement correctly determines whether the two variables' members contain the same data? (T/F) if (circle1 == circle2)

False

The names of enumerators in an enumerated data type must be enclosed in quotation marks. (T/F)

False

A struct can contain members with varying data types.

True

Any mathematical operation that can be performed on regular C++ variables can be performed on structure members. (T/F)

True

In C++11 if you want to retrieve a strongly typed enumerator's underlying integer value, you must use a cast operator. True False

True

The expression *s->p; indicates that s is a structure pointer and p, which is also a pointer, is a member of the structure pointed to by s.

True

The expression s->m; indicates that s is a structure pointer and m is a structure member.

True

When a programmer creates an abstract data type, he or she can decide what values are acceptable for the data type, as well as what operations may be performed on the data type.

True

Data types that are created by the programmer are known as functions variables parameters abstract data types (ADTs) None of these

abstract data types (ADTs)

A structure ________ contain members of the same data type. cannot shouldn't can None of these

can

Before a structure can be used it must be dereferenced declared initialized All of these None of these

declared

With an enumerated data type, the enumerators are stored in memory as doubles strings integers characters

integers

If a is a structure variable and p, a pointer, is a member of the structure, what will the following statement do? cout << *a.p; result in a compiler error output the value stored in a output the dereferenced value pointed to by p output the address stored in p None of these

output the dereferenced value pointed to by p

The name of a structure is referred to as its tag data type argument parameter None of these

tag

If Circle is a structure tag, then the following statement can be the header line for a function that ________. Circle doSomething(Circle c2) determines and returns the area of a circle takes two Circle parameters and does something operates on a constant reference to a Circle structure takes a Circle structure as a parameter, does something, and returns a Circle structure None of these

takes a Circle structure as a parameter, does something, and returns a Circle structure

To dereference a structure pointer, the appropriate operator is the ampersand (&) the <- operator (<-) the -> operator an asterisk (*) None of these

the -> operator

A structure pointer contains the address of a structure tag the dereferenced address of a structure tag the address of a structure variable the name and address of the structure tag None of these

the address of a structure variable

A good reason to pass a structure as a constant reference is to slow down the function's execution which helps prevent errors to ensure changes to the structure's members to prevent changes to the structure's members to speed up the function's modification of the structure's members None of these

to prevent changes to the structure's members

The following statement ________. bookList[2].publisher[3] = 't'; will change the name of the second book in bookList to 't' is illegal in C++ will result in a runtime error will store the character 't' in the fourth element of the publisher member of bookList[2] None of these

will store the character 't' in the fourth element of the publisher member of bookList[2]


Related study sets

TestOut CyberDefense Pro Chapter 4

View Set

Ch 14 Assessing Skin, Hair, and Nails

View Set

Chapter 65: Caring for Clients with Skin, Hair, and Nail Disorders (NCLEX Review Questions/ PrepU)

View Set

RPV ESL Present Continuous What are you doing? (Spanish)

View Set

The Power Elite - C. Wright Mills

View Set

READING 3: PROBABILITY CONCEPTS QB

View Set