Ch 11 Quiz

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

True/False: A struct can contain members with varying data types.

True

True/False: Any mathematical operations that can be performed on regular C++ variables can be performed on structure members

True

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

enum

You may use a pointer to a structure as a ________.

function return type structure member function parameter (All of these!)

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 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: 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: Structure variables may be passed as arguments to functions.

True

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

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

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

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

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

With an enumerated data type, the enumerators are stored in memory as ________.

integers

The name of the structure is referred to as its ________

tag

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

To dereference a structure pointer, the appropriate operator is ________.

the structure pointer operator, ->

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 char long double unsigned short int All of these!


Set pelajaran terkait

Chapter 15: Intraoperative Nursing Management

View Set

PrepU Ch. 3: Growth & Development of the Newborn & Infant

View Set

পারিভাষিক শব্দ A-M

View Set

小壁虎借尾巴 (xiao bi hu jie wei ba )

View Set