CS3376 Structures

Ace your homework & exams now with Quizwiz!

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;

A declaration for an enumerated type begins with this key word

enum

enum Tree { OAK, MAPLE, PINE }; What is the value of the following relational expression? OAK > PINE

false

You may use a pointer to a structure as a

function parameter, structure member, or function return type

Passing a structure as a constant reference parameter to a function

guarantees not to result in changes to the structure's members

This is required after the closing brace of the structure declaration.

semicolon

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

1

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

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 (ADTs)

This describes only the general characteristics of an object.

abstraction

Members of a(n) __ union have names, but the union itself has no name.

anonymous

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;

Before a structure can be used, it must be

declared

If an anonymous union is declared globally (outside all functions), it must be

declared static

If Circle is a structure tag, the statement Circle *pcirc;

declares a structure pointer called pcirc

This allows you to access structure members

dot operator

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

integers

What does bookList[2].publisher[3] = 't'; do?

it stores the character 't' in the fourth element of the publisher member of booklist[2].

A function __ return a structure.

may

The name of the structure is referred to as its

none of these

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 structure pointer contains:

the address of a structure variable

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

This is like a structure, except all members occupy the same memory area.

union

These are examples of C++ primitive data types

unsigned short int, long double, unsigned char


Related study sets

Hate my life right now chapter. 13

View Set

Legal Environment of Business CH 23 Administrative Agencies

View Set

Gateway A1+. Vocabulary from instructions

View Set