Chapter 11
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;
A) "Output" the" dereferenced" value" pointed" to" by" p.
"Look"at"the"following"structure"declaration. struct Employee { string name; int idNum; }; In"this"declaration,"idNum is:
A)"a"member
8) "Members" of "a(n) "________ "union" have "names, "but" the" union "itself "has" no "name.
A)"anonymous
5)"When"a"structure"is"passed"________"to"a function,"its"members"are"not"copied.
A)"by"reference
14)"Before "a" structure" can" be" used," it "must" be" ________.
A)"declared
17)"A"function"________"return"a"structure.
A)"may
18)"A"structure"pointer"contains"________.
A)"the"address"of"a"structure"variable
24)"A good" reason "to "pass" a" structure "as "a "constant "reference" is "________.
A)"to "prevent "changes" to "the "structure "members
13) Data types that are created by the programmer are known as ________.
B) abstract data types (ADT)
If Circle is a structure tag, the statement: Circle doSomething(Circle c2) can be the header line for a function that ________.
B) takes a Circle structure as a parameter, does something, and returns a Circle structure
6)" Passing "a" structure" as "a "constant "reference "parameter" to" a" function" ________.
B)" guarantees not "to" result "in" changes" to" the" structure's "members
21) "A" structure" ________" contain" members" of "the" same" data" type.
B)"can
12)" If "an" anonymous" union" is "declared" globally "(outside" all" functions), "it" must "be "________.
B)"declared"static
If"Circle is"a"structure,"the"statement: Circle *pcirc = nullptr;
B)"declares"a"structure"pointer"called pcirc initialized"with"a"null"pointer
16)"This" allows "you" to "access" structure "members.
B)"dot"operator
Look"at"the"following"declaration. enum Tree { OAK, MAPLE, PINE }; What"is"the"value"of"the"following"relational"expression? OAK > PINE
B)"false
27)" With" an" enumerated "data "type, "the "enumerators" are" stored" in" memory" as" ________.
B)"integers
7) This is like a structure, except all members occupy the same memory area.
B)"union
"Look"at"the"following"structure"declaration. struct Employee { string name; int idNum; }; In"this"declaration,"Employee is:
C)"a"tag
Which of the following statements outputs the value of the gpa member"of"element"1"of"the" student array?
C)"cout << student[1].gpa;
26) A declaration for an enumerated type begins with the ________ key word.
C)"enum
3)" This "is" required "after "the "closing" brace "of "the" structure "declaration.
C)"semicolon
19)" To" dereference" a" structure "pointer, "the "appropriate" operator" is "________.
C)"the"structure"pointer"operator,"->
"Look"at"the"following"statement. bookList[2].publisher[3] = 't'; This"statement"________.
C)"will"store"the"character"'t' in"the"fourth"element"of"the"publisher member"of"booklist[2]
11) You may use a pointer to a structure as a ________.
D)"All"of"these
2)" Which" of" the "following" is "an "example" of "a "C++" primitive "data" type?
D)"All"of"these
10)" Which "of" the" following" assigns" a" value" to" the" hourlyWage member "of "employee[2]?
D)"employee[2].hourlyWage = 100.00;
"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.
D)"strongly"typed"enum
Look"at"the"following"declaration. enum Tree { OAK, MAPLE, PINE }; In"memory,"what"value"will"the"MAPLE enumerator"be"stored"as?
E)"1.0
15)"The" name" of" the" structure "is "referred "to "as" its" ________.
E)"None"of"these
"True/False:"" The" names "of "the "enumerators "in" an" enumerated" data" type" must "be" enclosed" in" quotation" marks.
FALSE
15)"True/False:" "A" union" can" only" have" one" member.
FALSE
18)"True/False:" "You" cannot" directly "assign" an" enumerator" to" an" int variable.
FALSE
6) 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: "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:" "Any "mathematical" operations "that" can "be "performed" on "regular "C++" variables" can" be" performed" on" structure" members.
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
1)"True/False:"" A" struct can" contain" members "with" varying" data "types.
TRUE
11)"True/False:" "It" is" possible" for" a" structure "variable "to "be "a "member" of" another "structure "variable.
TRUE
13)"True/False:" "It" is" possible" for "a" structure" to" contain "as "a "member" a" pointer" to" its" own" structure" type.
TRUE
17)"True/False:" You" cannot" directly" assign" an" integer "value" to" an" enum variable.
TRUE
3)"True/False:" "Structure" variables" may "be" passed" as" arguments" to" functions.
TRUE
5)"True/False:""The"expression"s->m; indicates"that"s is"a"structure"pointer"and"m is"a"structure"member.
TRUE
8)"True/False:" "You" can" define" any" number "of" union" variables, "but "each "variable "can "only" store" the" value"
TRUE
True/False: An anonymous union declaration actually creates the member variables in memory.
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
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:" "In "C++" 11, "if "you" want "to" retrieve" a "strongly "typed" enumerator's "underlying "integer" value," you" must "use" a" cast "operator.
TRUE
"This "describes "only" the" general "characteristics "of" an "object.
abstraction