Deck 13: Structures
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 13: Structures
1
Structure data items or fields are called ____ of the structure.
A) instances
B) members
C) types
D) names
A) instances
B) members
C) types
D) names
B
2
The real power of structures is realized when the same structure is used for ____.
A) lists of data
B) heterogeneous data
C) strings of data
D) all class members
A) lists of data
B) heterogeneous data
C) strings of data
D) all class members
A
3
Union members are referenced by using the same notation as structure members.
True
4
The NULL pointer has no numerical value.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
Unions can be members of structures or arrays.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
As with all external and static variables, in the absence of explicit initializers, the numeric elements of static and external arrays or structures are initialized to ____.
A) undefined
B) -2
C) -1
D) 0
A) undefined
B) -2
C) -1
D) 0
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
A C++ structure can also be declared as a(n) ____ with no member functions and all public data members.
A) class
B) string
C) array
D) constant
A) class
B) string
C) array
D) constant
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
A single ____ is simply a convenient method for combining and storing related items under a common name.
A) array
B) structure
C) string
D) instance variable
A) array
B) structure
C) string
D) instance variable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
Declaring an array of structures is different from declaring an array of any other variable type.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
Declaring a structure requires listing the data ____, data names, and arrangement of data items.
A) objects
B) instances
C) types
D) spaces
A) objects
B) instances
C) types
D) spaces
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
A C++ class can be declared as a(n) ____ having all private data members and all public member functions.
A) object
B) two-dimensional array
C) array
D) structure
A) object
B) two-dimensional array
C) array
D) structure
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
An array is a ____ data structure, which means all its components must be of the same data type.
A) hybrid
B) compound
C) homogeneous
D) heterogeneous
A) hybrid
B) compound
C) homogeneous
D) heterogeneous
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
The steps for returning a structure from a function are identical to the procedures for returning scalar data types.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
The -> operator is a hyphen followed by a greater-than symbol.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
For structures, multiple variables can be defined in the same statement.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
Assigning actual data values to a structure s members is referred to as ____ the structure.
A) defining
B) filling
C) declaring
D) populating
A) defining
B) filling
C) declaring
D) populating
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
By convention, the first letter of a user-selected data type name is lowercase.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
Copies of all structure members can be passed to a function by including the name of the structure as an argument to the called function.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
As with all external and static variables, in the absence of explicit initializers, the character elements of static and external arrays or structures are initialized to ____.
A) -1
B) NULL
C) a blank space
D) 0
A) -1
B) NULL
C) a blank space
D) 0
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
Creating and using a structure involves the same two steps for creating and using any variable.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
A(n) ____ is a set of structures in which each structure contains at least one member whose value is the address of the next logically ordered structure in the list.
A) array
B) linked list
C) class
D) string
A) array
B) linked list
C) class
D) string
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
A(n) ____ is a data type that reserves the same area in memory for two or more variables that can be different data types.
A) array
B) union
C) class
D) structure
A) array
B) union
C) class
D) structure
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
Structure ____________________ can be any valid C++ data type.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
The initialization of structures follows the same rules as for the initialization of ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
In the expression ____, the address in pt is incremented before the hours member is accessed.
A) ++pt->hours
B) (++pt) ->hours
C) ++pt->(hours)
D) ++(pt->hours)
A) ++pt->hours
B) (++pt) ->hours
C) ++pt->(hours)
D) ++(pt->hours)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
The statement display(emp.idNum); passes ____ the structure member emp.idNum to a function named display() .
A) the address of
B) a copy of
C) a pointer to
D) the name of
A) the address of
B) a copy of
C) a pointer to
D) the name of
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
The ____ operator reserves the number of bytes required by the requested data type.
A) delete
B) free
C) allocnew
D) new
A) delete
B) free
C) allocnew
D) new
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
The expression ____ uses the postfix increment operator to increment the address in pt after the hours member is accessed.
A) (pt->hours) ++
B) pt->hours++
C) (pt++) ->hours
D) pt++->hours
A) (pt->hours) ++
B) pt->hours++
C) (pt++) ->hours
D) pt++->hours
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
A structure is a(n) ____________________ data structure, which means that each of its components can be of different data types.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
The general expression (*pointer).member can always be replaced with the notation ____.
A) *pointer.member
B) *pointer-member
C) *(pointer.member)
D) pointer->member
A) *pointer.member
B) *pointer-member
C) *(pointer.member)
D) pointer->member
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
When working with linked lists, records are linked together by including the ____ of the next record in the record immediately preceding it.
A) address
B) name
C) id
D) object sequence number
A) address
B) name
C) id
D) object sequence number
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
Each structure member is accessed by giving both the ____________________ name and the data item name.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
Assuming Employee is an already declared structure, the function definition calcNet(Employee *pt) declares the pt parameter as a(n) ____ to a structure of type Employee .
A) pointer
B) class
C) object
D) instance
A) pointer
B) class
C) object
D) instance
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
The only argument delete requires is the ____ of a storage block that was allocated dynamically.
A) name
B) data type
C) starting address
D) number of bytes
A) name
B) data type
C) starting address
D) number of bytes
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
The NULL pointer value, like its end-of-string counterpart, has a numerical value of ____.
A) -2
B) 0
C) 13
D) 32
A) -2
B) 0
C) 13
D) 32
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
The ____ manipulator included in the cout stream forces each name to be displayed left justified in its designated field width.
A) setiosflags(ios::justified)
B) setiosflags(justified::left)
C) setiosflags(ios::left)
D) setiosflags(ios::right)
A) setiosflags(ios::justified)
B) setiosflags(justified::left)
C) setiosflags(ios::left)
D) setiosflags(ios::right)
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
Both arrays and structures are ____________________ data types.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
C++ provides a special pointer value called ____ that acts as a sentinel or flag to indicate when the last record on a linked list has been processed.
A) EMPTY
B) LAST
C) NULL
D) ZERO
A) EMPTY
B) LAST
C) NULL
D) ZERO
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
The ____ operator restores a block of storage to the computer at runtime.
A) delete
B) malloc
C) new
D) alloc
A) delete
B) malloc
C) new
D) alloc
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
The definition of a union has the same form as a structure definition, with the keyword(s) ____ used in place of the keyword struct .
A) using union
B) struct_union
C) union_struct
D) union
A) using union
B) struct_union
C) union_struct
D) union
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
The member operator, . , has a(n) ____________________ precedence compared to the indirection operator * .
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
An alternative to the pass-by-value function call, in which the called function receives a copy of a structure, is a pass by reference that passes a(n) ____________________ to a structure.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
When working with a linked list, besides an end-of-list sentinel value, a special pointer must be provided for storing the address of the ____________________ structure in the list.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Adding a structure to an array of structures requires shifting all ____________________ below the addition down to make room for the new entry.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
Structure members can be passed to a function in the same manner as any ____________________ variable.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
Structures, arrays, and ____________________ can be members of unions.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
The -> operator has a(n) ____________________ priority compared to the increment operator.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
In practice, most structure handling functions get direct access to a structure by receiving a structure reference or ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
Any address that the new operator returns can be passed subsequently to ____________________ to restore the reserved memory to the computer.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
A(n) ____________________ list provides a convenient method for maintaining a constantly changing list, without needing to reorder and restructure the entire list.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck