Deck 11: Structured Data

Full screen (f)
exit full mode
Question
Look at the following statement. <strong>Look at the following statement.   This statement ________.</strong> A)is illegal in C++ B)will change the publisher's name of the second book in bookList to 't' C)will store the character 't' in the fourth element of the publisher member of booklist[2] D)will ultimately result in a runtime error E)None of these <div style=padding-top: 35px>
This statement ________.

A)is illegal in C++
B)will change the publisher's name of the second book in bookList to 't'
C)will store the character 't' in the fourth element of the publisher member of booklist[2]
D)will ultimately result in a runtime error
E)None of these
Use Space or
up arrow
down arrow
to flip the card.
Question
If Circle is a structure tag, the statement: <strong>If Circle is a structure tag, the statement:   Can be the header line for a function that ________.</strong> A)determines and returns the area of a circle B)takes a Circle structure as a parameter, does something, and returns a Circle structure C)operates on a constant reference to a Circle structure D)takes two Circle parameters and does something E)None of these <div style=padding-top: 35px>
Can be the header line for a function that ________.

A)determines and returns the area of a circle
B)takes a Circle structure as a parameter, does something, and returns a Circle structure
C)operates on a constant reference to a Circle structure
D)takes two Circle parameters and does something
E)None of these
Question
A function ________ return a structure.

A)may
B)may not
C)will always
D)cannot possibly
E)None of these
Question
This allows you to access structure members.

A)structure access operator
B)dot operator
C)#include directive
D)getmember function
E)None of these
Question
You may use a pointer to a structure as a ________.

A)function parameter
B)structure member
C)function return type
D)All of these
E)None of these
Question
This describes only the general characteristics of an object.

A)initialization
B)abstraction
C)detailed specification
D)initiation
E)None of these
Question
Which of the following assigns a value to the hourlyWage member of employee[2]?

A)employee[2]->hourlyWage = 50.00;
B)employee2.hourlyWage = 7.50;
C)hourlyWage[2].employee = 29.75
D)employee[2].hourlyWage = 100.00;
E)None of these
Question
When a structure is passed ________ to a function, its members are not copied.

A)by reference
B)by value
C)Neither of these
Question
The name of the structure is referred to as its ________.

A)data type
B)argument
C)parameter
D)tag
E)None of these
Question
Data types that are created by the programmer are known as ________.

A)variables
B)abstract data types (ADT)
C)functions
D)parameters
E)None of these
Question
A structure pointer contains ________.

A)the address of a structure variable
B)the dereferenced address of a structure tag
C)the name and address of the structure tag
D)the address of a structure tag
E)None of these
Question
Members of a(n)________ union have names, but the union itself has no name.

A)anonymous
B)dereferenced
C)organized
D)declared
E)None of these
Question
Passing a structure as a constant reference parameter to a function ________.

A)can potentially result in changes to the structure's members
B)guarantees not to result in changes to the structure's members
C)will always change the structure's members
D)All of these
E)None of these
Question
If a is a structure variable and p, a pointer, is a member of the structure, what will the following statement do?
<strong>If a is a structure variable and p, a pointer, is a member of the structure, what will the following statement do?  </strong> A)Output the dereferenced value pointed to by p. B)Result in a compiler error. C)Output the address stored in p. D)Output the value stored in a. E)None of these <div style=padding-top: 35px>

A)Output the dereferenced value pointed to by p.
B)Result in a compiler error.
C)Output the address stored in p.
D)Output the value stored in a.
E)None of these
Question
Which of the following is an example of a C++ primitive data type?

A)unsigned short int
B)long double
C)unsigned char
D)All of these
E)None of these
Question
This is required after the closing brace of the structure declaration.

A)square bracket
B)period
C)semicolon
D)colon
E)None of these
Question
This is like a structure, except all members occupy the same memory area.

A)array
B)union
C)structure pointer
D)array of pointers
E)None of these
Question
If an anonymous union is declared globally (outside all functions), it must be ________.

A)empty
B)declared static
C)explicitly declared "global"
D)initialized and used outside any function
E)None of these
Question
Before a structure can be used, it must be ________.

A)declared
B)dereferenced
C)initialized
D)All of these
E)None of these
Question
To dereference a structure pointer, the appropriate operator is ________.

A)the ampersand, &
B)an asterisk, *
C)the structure pointer operator, ->
D)the dereference operator, <-
E)None of these
Question
The expression s->m; indicates that s is a structure pointer and m is a structure member.
Question
Structure variables may be passed as arguments to functions.
Question
The structure pointer operator is used to dereference a pointer to a structure, not a pointer that is a member of a structure.
Question
A struct can contain members with varying data types.
Question
You can define any number of union variables, but each variable can only store the value of one member at a time.
Question
Look at the following declaration.<strong>Look at the following declaration.  In memory, what value will the MAPLE enumerator be stored as?</strong> A)MAPLE B)2 C)'M' D)1 E)1.0 <div style=padding-top: 35px>
In memory, what value will the MAPLE enumerator be stored as?

A)"MAPLE"
B)2
C)'M'
D)1
E)1.0
Question
If Circle is a structure, the statement: <strong>If Circle is a structure, the statement:  </strong> A)declares an empty structure variable called *pcirc B)declares a structure pointer called pcirc initialized with a null pointer C)is illegal in C++ D)initializes a null pointer with the value of the Circle pointer E)None of these <div style=padding-top: 35px>

A)declares an empty structure variable called *pcirc
B)declares a structure pointer called pcirc initialized with a null pointer
C)is illegal in C++
D)initializes a null pointer with the value of the Circle pointer
E)None of these
Question
Which of the following statements outputs the value of the gpa member of element 1 of the student array?

A)cout << student1.gpa;
B)cout << firstStudent.gpa;
C)cout << student[1].gpa;
D)cout << student1->gpa;
E)None of these
Question
If a function is legally prototyped to return an integer value, it can return a structure member that is an integer data type.
Question
With an enumerated data type, the enumerators are stored in memory as ________.

A)strings
B)integers
C)characters
D)doubles
Question
Look at the following structure declaration. struct <strong>Look at the following structure declaration. struct   In this declaration, idNum is:</strong> A)a member B)an array C)a tag D)None of these <div style=padding-top: 35px>
In this declaration, idNum is:

A)a member
B)an array
C)a tag
D)None of these
Question
Look at the following structure declaration.
<strong>Look at the following structure declaration.   In this declaration, Employee is:</strong> A)a member B)an array C)a tag D)None of these <div style=padding-top: 35px>
In this declaration, Employee is:

A)a member
B)an array
C)a tag
D)None of these
Question
Look at the following declaration.<strong>Look at the following declaration.  What is the value of the following relational expression? OAK > PINE</strong> A)true B)false C)This is an error. You cannot compare enumerators with relational operators. <div style=padding-top: 35px>
What is the value of the following relational expression?
OAK > PINE

A)true
B)false
C)This is an error. You cannot compare enumerators with relational operators.
Question
A good reason to pass a structure as a constant reference is ________.

A)to prevent changes to the structure members
B)to ensure changes to the structure members
C)to slow down the function's execution, preventing errors
D)to speed up the function's modification of the structure members
E)None of these
Question
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.

A)universal enum
B)auto enum
C)multi-cast enum
D)strongly typed enum
E)None of these
Question
Any mathematical operations that can be performed on regular C++ variables can be performed on structure members.
Question
A structure ________ contain members of the same data type.

A)cannot
B)can
C)shouldn't
D)None of these
Question
A function cannot modify the members of a structure.
Question
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.
Question
A declaration for an enumerated type begins with the ________ key word.

A)enumerated
B)enum_type
C)enum
D)ENUM
Question
A union can only have one member.
Question
The names of the enumerators in an enumerated data type must be enclosed in quotation marks.
Question
Look at the following structure declaration.
Look at the following structure declaration.  <div style=padding-top: 35px>
Question
You cannot directly assign an enumerator to an int variable.
Question
An anonymous union declaration actually creates the member variables in memory.
Question
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.
Question
It is possible for a structure variable to be a member of another structure variable.
Question
It is possible for a structure to contain as a member a pointer to its own structure type.
Question
In C++ 11, if you want to retrieve a strongly typed enumerator's underlying integer value, you must use a cast operator.
Question
The following union declaration appears on a system uses 4-byte ints and 8-byte doubles.
The following union declaration appears on a system uses 4-byte ints and 8-byte doubles.  <div style=padding-top: 35px>
Question
You cannot directly assign an integer value to an enum variable.
Question
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.
Question
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.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/53
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 11: Structured Data
1
Look at the following statement. <strong>Look at the following statement.   This statement ________.</strong> A)is illegal in C++ B)will change the publisher's name of the second book in bookList to 't' C)will store the character 't' in the fourth element of the publisher member of booklist[2] D)will ultimately result in a runtime error E)None of these
This statement ________.

A)is illegal in C++
B)will change the publisher's name of the second book in bookList to 't'
C)will store the character 't' in the fourth element of the publisher member of booklist[2]
D)will ultimately result in a runtime error
E)None of these
will store the character 't' in the fourth element of the publisher member of booklist[2]
2
If Circle is a structure tag, the statement: <strong>If Circle is a structure tag, the statement:   Can be the header line for a function that ________.</strong> A)determines and returns the area of a circle B)takes a Circle structure as a parameter, does something, and returns a Circle structure C)operates on a constant reference to a Circle structure D)takes two Circle parameters and does something E)None of these
Can be the header line for a function that ________.

A)determines and returns the area of a circle
B)takes a Circle structure as a parameter, does something, and returns a Circle structure
C)operates on a constant reference to a Circle structure
D)takes two Circle parameters and does something
E)None of these
takes a Circle structure as a parameter, does something, and returns a Circle structure
3
A function ________ return a structure.

A)may
B)may not
C)will always
D)cannot possibly
E)None of these
may
4
This allows you to access structure members.

A)structure access operator
B)dot operator
C)#include directive
D)getmember function
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
5
You may use a pointer to a structure as a ________.

A)function parameter
B)structure member
C)function return type
D)All of these
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
6
This describes only the general characteristics of an object.

A)initialization
B)abstraction
C)detailed specification
D)initiation
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
7
Which of the following assigns a value to the hourlyWage member of employee[2]?

A)employee[2]->hourlyWage = 50.00;
B)employee2.hourlyWage = 7.50;
C)hourlyWage[2].employee = 29.75
D)employee[2].hourlyWage = 100.00;
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
8
When a structure is passed ________ to a function, its members are not copied.

A)by reference
B)by value
C)Neither of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
9
The name of the structure is referred to as its ________.

A)data type
B)argument
C)parameter
D)tag
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
10
Data types that are created by the programmer are known as ________.

A)variables
B)abstract data types (ADT)
C)functions
D)parameters
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
11
A structure pointer contains ________.

A)the address of a structure variable
B)the dereferenced address of a structure tag
C)the name and address of the structure tag
D)the address of a structure tag
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
12
Members of a(n)________ union have names, but the union itself has no name.

A)anonymous
B)dereferenced
C)organized
D)declared
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
13
Passing a structure as a constant reference parameter to a function ________.

A)can potentially result in changes to the structure's members
B)guarantees not to result in changes to the structure's members
C)will always change the structure's members
D)All of these
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
14
If a is a structure variable and p, a pointer, is a member of the structure, what will the following statement do?
<strong>If a is a structure variable and p, a pointer, is a member of the structure, what will the following statement do?  </strong> A)Output the dereferenced value pointed to by p. B)Result in a compiler error. C)Output the address stored in p. D)Output the value stored in a. E)None of these

A)Output the dereferenced value pointed to by p.
B)Result in a compiler error.
C)Output the address stored in p.
D)Output the value stored in a.
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following is an example of a C++ primitive data type?

A)unsigned short int
B)long double
C)unsigned char
D)All of these
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
16
This is required after the closing brace of the structure declaration.

A)square bracket
B)period
C)semicolon
D)colon
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
17
This is like a structure, except all members occupy the same memory area.

A)array
B)union
C)structure pointer
D)array of pointers
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
18
If an anonymous union is declared globally (outside all functions), it must be ________.

A)empty
B)declared static
C)explicitly declared "global"
D)initialized and used outside any function
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
19
Before a structure can be used, it must be ________.

A)declared
B)dereferenced
C)initialized
D)All of these
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
20
To dereference a structure pointer, the appropriate operator is ________.

A)the ampersand, &
B)an asterisk, *
C)the structure pointer operator, ->
D)the dereference operator, <-
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
21
The expression s->m; indicates that s is a structure pointer and m is a structure member.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
22
Structure variables may be passed as arguments to functions.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
23
The structure pointer operator is used to dereference a pointer to a structure, not a pointer that is a member of a structure.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
24
A struct can contain members with varying data types.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
25
You can define any number of union variables, but each variable can only store the value of one member at a time.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
26
Look at the following declaration.<strong>Look at the following declaration.  In memory, what value will the MAPLE enumerator be stored as?</strong> A)MAPLE B)2 C)'M' D)1 E)1.0
In memory, what value will the MAPLE enumerator be stored as?

A)"MAPLE"
B)2
C)'M'
D)1
E)1.0
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
27
If Circle is a structure, the statement: <strong>If Circle is a structure, the statement:  </strong> A)declares an empty structure variable called *pcirc B)declares a structure pointer called pcirc initialized with a null pointer C)is illegal in C++ D)initializes a null pointer with the value of the Circle pointer E)None of these

A)declares an empty structure variable called *pcirc
B)declares a structure pointer called pcirc initialized with a null pointer
C)is illegal in C++
D)initializes a null pointer with the value of the Circle pointer
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
28
Which of the following statements outputs the value of the gpa member of element 1 of the student array?

A)cout << student1.gpa;
B)cout << firstStudent.gpa;
C)cout << student[1].gpa;
D)cout << student1->gpa;
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
29
If a function is legally prototyped to return an integer value, it can return a structure member that is an integer data type.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
30
With an enumerated data type, the enumerators are stored in memory as ________.

A)strings
B)integers
C)characters
D)doubles
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
31
Look at the following structure declaration. struct <strong>Look at the following structure declaration. struct   In this declaration, idNum is:</strong> A)a member B)an array C)a tag D)None of these
In this declaration, idNum is:

A)a member
B)an array
C)a tag
D)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
32
Look at the following structure declaration.
<strong>Look at the following structure declaration.   In this declaration, Employee is:</strong> A)a member B)an array C)a tag D)None of these
In this declaration, Employee is:

A)a member
B)an array
C)a tag
D)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
33
Look at the following declaration.<strong>Look at the following declaration.  What is the value of the following relational expression? OAK > PINE</strong> A)true B)false C)This is an error. You cannot compare enumerators with relational operators.
What is the value of the following relational expression?
OAK > PINE

A)true
B)false
C)This is an error. You cannot compare enumerators with relational operators.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
34
A good reason to pass a structure as a constant reference is ________.

A)to prevent changes to the structure members
B)to ensure changes to the structure members
C)to slow down the function's execution, preventing errors
D)to speed up the function's modification of the structure members
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
35
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.

A)universal enum
B)auto enum
C)multi-cast enum
D)strongly typed enum
E)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
36
Any mathematical operations that can be performed on regular C++ variables can be performed on structure members.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
37
A structure ________ contain members of the same data type.

A)cannot
B)can
C)shouldn't
D)None of these
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
38
A function cannot modify the members of a structure.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
39
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.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
40
A declaration for an enumerated type begins with the ________ key word.

A)enumerated
B)enum_type
C)enum
D)ENUM
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
41
A union can only have one member.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
42
The names of the enumerators in an enumerated data type must be enclosed in quotation marks.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
43
Look at the following structure declaration.
Look at the following structure declaration.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
44
You cannot directly assign an enumerator to an int variable.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
45
An anonymous union declaration actually creates the member variables in memory.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
46
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.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
47
It is possible for a structure variable to be a member of another structure variable.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
48
It is possible for a structure to contain as a member a pointer to its own structure type.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
49
In C++ 11, if you want to retrieve a strongly typed enumerator's underlying integer value, you must use a cast operator.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
50
The following union declaration appears on a system uses 4-byte ints and 8-byte doubles.
The following union declaration appears on a system uses 4-byte ints and 8-byte doubles.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
51
You cannot directly assign an integer value to an enum variable.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
52
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.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
53
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.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 53 flashcards in this deck.