M Chapter 11

¡Supera tus tareas y exámenes ahora con Quizwiz!

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

Look at the following structure declaration. struct Employee { string name; int idNum; }; In this declaration, idNum is:

a member

This allows you to access structure members.

dot operator

Which of the following assigns a value to the hourlyWage member of employee[2]?

employee[2].hourlyWage = 100.00;

A declaration for an enumerated type begins with the ________ key word

enum

A declaration for an enumerated type begins with the ________ key word.

enum

This is required after the closing brace of the structure declaration

semicolon

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

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]

Look at the following declaration. enum Tree { OAK, MAPLE, PINE }; In memory, what value will the MAPLE enumerator be stored as?

1

Which of the following is an example of a C++ primitive data type? unsigned char long double unsigned short int All of these

All of these

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

All of these

Look at the following structure declaration. struct Circle { double centerX; double centerY; double 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: A function cannot modify the members of a structure

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: You cannot directly assign an enumerator to an int variable.

False

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;

Output the dereferenced value pointed to by p.

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 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

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

True

True/False: When you use a strongly typed enumerator in C++ 11, you must prefix the enumerator with the name of the enum, followed by the :: operator.

True

True/False: You cannot directly assign an integer value to an enum variable.

True

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

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;

Before a structure can be used, it must be ________

declared

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

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


Conjuntos de estudio relacionados

Chapter 3: Project Management Process Groups

View Set

Section 8, Unit 3: FHA Loans and the Consumer Workshops

View Set

Nursing Care of the Newborn 1235 eaq pain

View Set

Microsoft Intermediate Excel Certification

View Set