Deck 14: Advanced Topics

Full screen (f)
exit full mode
Question
The decimal value of the binary number 10100 is ____.

A) 4
B) 16
C) 20
D) 32
Use Space or
up arrow
down arrow
to flip the card.
Question
The ____ function is used to show the size in bytes of any object or type.

A) size()
B) sizeof()
C) len()
D) length()
Question
Quick sort and pivot sort are names for recursive sorting methods.
Question
You cannot use the address operator (&) with a bit field.
Question
The bitwise ____ operator compares the bits of its two operands, and produces a result in which each bit is a 1 if either of the operand's corresponding bits is a 1.

A) complement
B) AND
C) exclusive OR
D) OR
Question
The bitwise ____ operator compares the individual bits of its two operands and produces a result in which each bit is a 1 where both operands contain a 1; the result is 0 in all other bit positions.

A) OR
B) AND
C) complement
D) exclusive OR
Question
The identifiers in an enum must be unique within a block.
Question
For any number n , shifting n bits to the right is the same as multiplying by two to the n power.
Question
When a field is type ____ int , then it must be positive, because no bit is reserved for a sign, and all eight bits are used to store the value.

A) bitwise
B) short
C) positive
D) unsigned
Question
____ operators let you manipulate individual bits of integer or character values.

A) Binary
B) Unary
C) Bitwise
D) Logical
Question
On many systems a(n) ____ is the amount of storage required to store a single character, such as an alphabetic letter or punctuation mark.

A) bit
B) byte
C) mask
D) enumerator
Question
Separate enumerators cannot have the same value.
Question
The ____ keyword is required to declare a variable of type enumeration in C; this keyword can be omitted in C++.

A) enum
B) enumeration
C) list
D) define
Question
The declaration ____ declares a variable named aFlag that occupies one bit of storage.

A) bool aFlag:1;
B) bit aFlag:1;
C) int aFlag(1);
D) int aFlag:1;
Question
The far left bit in a byte is called the high-order bit.
Question
If you assign a value other than 0 or 1 to a bit field, ____.

A) a 0 is stored
B) a 1 is stored
C) only the far right bit is stored
D) only the far left bit is stored
Question
For any number n , shifting n bits to the left is the same as dividing by two to the n power.
Question
Suppose value1 contains the bit pattern 10101010, value2 contains the bit pattern 00001111, and result is set to result = value1 & value2; . The value of result is ____.

A) 8
B) 10
C) 14
D) 16
Question
The bitwise OR operator is ____.

A) &
B) &&
C) |
D) ||
Question
The bitwise AND operator is ____.

A) &
B) &&
C) |
D) ||
Question
Provide an example of a mechanical system that uses the decimal system.
Question
Write an enumeration Days that gives the values 0 through 6 to the identifiers SUN , MON , and so on.
Question
What happens if you use fewer than eight bits as fields in a class?
Question
Create a Months enumeration that defines JAN as month 1 and so on.
Question
If value is set to 46, then value is ____.

A) 20
B) 23
C) 80
D) 92
Question
In the pivot sort algorithm, some programmers prefer to use ____ as the pivot point for a sort instead of using the middle position.

A) the median
B) a random position
C) the first position
D) the last position
Question
When you declare a field to be a bit field, the field type must be int or unsigned int . Which type is preferable? Why?
Question
The bitwise ____ operator sets each bit in the result to 1 if the corresponding bit in the operand is 0, and each bit in the result to 0 if the corresponding bit in the operand is 1.

A) AND
B) OR
C) complement
D) exclusive OR
Question
The ____ is a memory location that holds addresses to which functions should return.

A) stack
B) queue
C) buffer
D) register
Question
The bitwise complement operator is ____.

A) !
B) @
C) ^
D) ~
Question
The ____________________ operator shifts bits to the left.
Question
The ____________________ operator shifts bits to the right.
Question
The bitwise left shift operator is ____.

A) <<
B) >>
C) <
D) >
Question
When you create a class with several bit fields, in what order are the bits placed within a byte?
Question
The bitwise right shift operator is ____.

A) <<
B) >>
C) <
D) >
Question
The bitwise exclusive OR operator is ____.

A) !
B) @
C) ^
D) ~
Question
Although not required by C++, by convention, a user-defined type begins with a(n) ____________________ letter.
Question
A function that calls itself is a(n) ____________________ function.
Question
All ____________________ numbers contain a 0 in the far right position.
Question
EBCDIC stands for __________________________________________________.
Question
Match between columns
occurs when a function is defined in terms of itself
recursion
occurs when a function is defined in terms of itself
byte
occurs when a function is defined in terms of itself
EBCDIC
occurs when a function is defined in terms of itself
binary system
occurs when a function is defined in terms of itself
enumerator
occurs when a function is defined in terms of itself
decimal system
occurs when a function is defined in terms of itself
bit
occurs when a function is defined in terms of itself
mask
occurs when a function is defined in terms of itself
enumeration
Question
Match between columns
value whose only purpose is to filter values from other variables
recursion
value whose only purpose is to filter values from other variables
byte
value whose only purpose is to filter values from other variables
EBCDIC
value whose only purpose is to filter values from other variables
binary system
value whose only purpose is to filter values from other variables
enumerator
value whose only purpose is to filter values from other variables
decimal system
value whose only purpose is to filter values from other variables
bit
value whose only purpose is to filter values from other variables
mask
value whose only purpose is to filter values from other variables
enumeration
Question
Write a recursive function cumulativeSum() in which for any argument, num , that is passed in with a value greater than 1, the function returns a value that is num plus the cumulativeSum() of num - 1. If num is 1, it returns that value.
Question
How does the bitwise exclusive OR operator (^) work?
Question
Match between columns
eight binary digits
recursion
eight binary digits
byte
eight binary digits
EBCDIC
eight binary digits
binary system
eight binary digits
enumerator
eight binary digits
decimal system
eight binary digits
bit
eight binary digits
mask
eight binary digits
enumeration
Question
Explain a recursive "divide and conquer" approach to quickly sorting a list.
Question
In C++, is the ampersand polymorphic or not? Explain.
Question
Match between columns
binary digit
recursion
binary digit
byte
binary digit
EBCDIC
binary digit
binary system
binary digit
enumerator
binary digit
decimal system
binary digit
bit
binary digit
mask
binary digit
enumeration
Question
Match between columns
coding system used in many mainframe computer systems
recursion
coding system used in many mainframe computer systems
byte
coding system used in many mainframe computer systems
EBCDIC
coding system used in many mainframe computer systems
binary system
coding system used in many mainframe computer systems
enumerator
coding system used in many mainframe computer systems
decimal system
coding system used in many mainframe computer systems
bit
coding system used in many mainframe computer systems
mask
coding system used in many mainframe computer systems
enumeration
Question
Match between columns
arithmetic system that uses the digits 0 through 9
recursion
arithmetic system that uses the digits 0 through 9
byte
arithmetic system that uses the digits 0 through 9
EBCDIC
arithmetic system that uses the digits 0 through 9
binary system
arithmetic system that uses the digits 0 through 9
enumerator
arithmetic system that uses the digits 0 through 9
decimal system
arithmetic system that uses the digits 0 through 9
bit
arithmetic system that uses the digits 0 through 9
mask
arithmetic system that uses the digits 0 through 9
enumeration
Question
Match between columns
arithmetic system that uses only 1s and 0s
recursion
arithmetic system that uses only 1s and 0s
byte
arithmetic system that uses only 1s and 0s
EBCDIC
arithmetic system that uses only 1s and 0s
binary system
arithmetic system that uses only 1s and 0s
enumerator
arithmetic system that uses only 1s and 0s
decimal system
arithmetic system that uses only 1s and 0s
bit
arithmetic system that uses only 1s and 0s
mask
arithmetic system that uses only 1s and 0s
enumeration
Question
Match between columns
named constant in an enumeration
recursion
named constant in an enumeration
byte
named constant in an enumeration
EBCDIC
named constant in an enumeration
binary system
named constant in an enumeration
enumerator
named constant in an enumeration
decimal system
named constant in an enumeration
bit
named constant in an enumeration
mask
named constant in an enumeration
enumeration
Question
Match between columns
programmer-defined set of integer constants represented by identifiers
recursion
programmer-defined set of integer constants represented by identifiers
byte
programmer-defined set of integer constants represented by identifiers
EBCDIC
programmer-defined set of integer constants represented by identifiers
binary system
programmer-defined set of integer constants represented by identifiers
enumerator
programmer-defined set of integer constants represented by identifiers
decimal system
programmer-defined set of integer constants represented by identifiers
bit
programmer-defined set of integer constants represented by identifiers
mask
programmer-defined set of integer constants represented by identifiers
enumeration
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 14: Advanced Topics
1
The decimal value of the binary number 10100 is ____.

A) 4
B) 16
C) 20
D) 32
C
2
The ____ function is used to show the size in bytes of any object or type.

A) size()
B) sizeof()
C) len()
D) length()
B
3
Quick sort and pivot sort are names for recursive sorting methods.
True
4
You cannot use the address operator (&) with a bit field.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
5
The bitwise ____ operator compares the bits of its two operands, and produces a result in which each bit is a 1 if either of the operand's corresponding bits is a 1.

A) complement
B) AND
C) exclusive OR
D) OR
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
6
The bitwise ____ operator compares the individual bits of its two operands and produces a result in which each bit is a 1 where both operands contain a 1; the result is 0 in all other bit positions.

A) OR
B) AND
C) complement
D) exclusive OR
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
7
The identifiers in an enum must be unique within a block.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
8
For any number n , shifting n bits to the right is the same as multiplying by two to the n power.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
9
When a field is type ____ int , then it must be positive, because no bit is reserved for a sign, and all eight bits are used to store the value.

A) bitwise
B) short
C) positive
D) unsigned
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
10
____ operators let you manipulate individual bits of integer or character values.

A) Binary
B) Unary
C) Bitwise
D) Logical
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
11
On many systems a(n) ____ is the amount of storage required to store a single character, such as an alphabetic letter or punctuation mark.

A) bit
B) byte
C) mask
D) enumerator
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
12
Separate enumerators cannot have the same value.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
13
The ____ keyword is required to declare a variable of type enumeration in C; this keyword can be omitted in C++.

A) enum
B) enumeration
C) list
D) define
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
14
The declaration ____ declares a variable named aFlag that occupies one bit of storage.

A) bool aFlag:1;
B) bit aFlag:1;
C) int aFlag(1);
D) int aFlag:1;
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
15
The far left bit in a byte is called the high-order bit.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
16
If you assign a value other than 0 or 1 to a bit field, ____.

A) a 0 is stored
B) a 1 is stored
C) only the far right bit is stored
D) only the far left bit is stored
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
17
For any number n , shifting n bits to the left is the same as dividing by two to the n power.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
18
Suppose value1 contains the bit pattern 10101010, value2 contains the bit pattern 00001111, and result is set to result = value1 & value2; . The value of result is ____.

A) 8
B) 10
C) 14
D) 16
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
19
The bitwise OR operator is ____.

A) &
B) &&
C) |
D) ||
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
20
The bitwise AND operator is ____.

A) &
B) &&
C) |
D) ||
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
21
Provide an example of a mechanical system that uses the decimal system.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
22
Write an enumeration Days that gives the values 0 through 6 to the identifiers SUN , MON , and so on.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
23
What happens if you use fewer than eight bits as fields in a class?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
24
Create a Months enumeration that defines JAN as month 1 and so on.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
25
If value is set to 46, then value is ____.

A) 20
B) 23
C) 80
D) 92
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
26
In the pivot sort algorithm, some programmers prefer to use ____ as the pivot point for a sort instead of using the middle position.

A) the median
B) a random position
C) the first position
D) the last position
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
27
When you declare a field to be a bit field, the field type must be int or unsigned int . Which type is preferable? Why?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
28
The bitwise ____ operator sets each bit in the result to 1 if the corresponding bit in the operand is 0, and each bit in the result to 0 if the corresponding bit in the operand is 1.

A) AND
B) OR
C) complement
D) exclusive OR
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
29
The ____ is a memory location that holds addresses to which functions should return.

A) stack
B) queue
C) buffer
D) register
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
30
The bitwise complement operator is ____.

A) !
B) @
C) ^
D) ~
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
31
The ____________________ operator shifts bits to the left.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
32
The ____________________ operator shifts bits to the right.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
33
The bitwise left shift operator is ____.

A) <<
B) >>
C) <
D) >
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
34
When you create a class with several bit fields, in what order are the bits placed within a byte?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
35
The bitwise right shift operator is ____.

A) <<
B) >>
C) <
D) >
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
36
The bitwise exclusive OR operator is ____.

A) !
B) @
C) ^
D) ~
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
37
Although not required by C++, by convention, a user-defined type begins with a(n) ____________________ letter.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
38
A function that calls itself is a(n) ____________________ function.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
39
All ____________________ numbers contain a 0 in the far right position.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
40
EBCDIC stands for __________________________________________________.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
41
Match between columns
occurs when a function is defined in terms of itself
recursion
occurs when a function is defined in terms of itself
byte
occurs when a function is defined in terms of itself
EBCDIC
occurs when a function is defined in terms of itself
binary system
occurs when a function is defined in terms of itself
enumerator
occurs when a function is defined in terms of itself
decimal system
occurs when a function is defined in terms of itself
bit
occurs when a function is defined in terms of itself
mask
occurs when a function is defined in terms of itself
enumeration
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
42
Match between columns
value whose only purpose is to filter values from other variables
recursion
value whose only purpose is to filter values from other variables
byte
value whose only purpose is to filter values from other variables
EBCDIC
value whose only purpose is to filter values from other variables
binary system
value whose only purpose is to filter values from other variables
enumerator
value whose only purpose is to filter values from other variables
decimal system
value whose only purpose is to filter values from other variables
bit
value whose only purpose is to filter values from other variables
mask
value whose only purpose is to filter values from other variables
enumeration
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
43
Write a recursive function cumulativeSum() in which for any argument, num , that is passed in with a value greater than 1, the function returns a value that is num plus the cumulativeSum() of num - 1. If num is 1, it returns that value.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
44
How does the bitwise exclusive OR operator (^) work?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
45
Match between columns
eight binary digits
recursion
eight binary digits
byte
eight binary digits
EBCDIC
eight binary digits
binary system
eight binary digits
enumerator
eight binary digits
decimal system
eight binary digits
bit
eight binary digits
mask
eight binary digits
enumeration
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
46
Explain a recursive "divide and conquer" approach to quickly sorting a list.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
47
In C++, is the ampersand polymorphic or not? Explain.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
48
Match between columns
binary digit
recursion
binary digit
byte
binary digit
EBCDIC
binary digit
binary system
binary digit
enumerator
binary digit
decimal system
binary digit
bit
binary digit
mask
binary digit
enumeration
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
49
Match between columns
coding system used in many mainframe computer systems
recursion
coding system used in many mainframe computer systems
byte
coding system used in many mainframe computer systems
EBCDIC
coding system used in many mainframe computer systems
binary system
coding system used in many mainframe computer systems
enumerator
coding system used in many mainframe computer systems
decimal system
coding system used in many mainframe computer systems
bit
coding system used in many mainframe computer systems
mask
coding system used in many mainframe computer systems
enumeration
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
50
Match between columns
arithmetic system that uses the digits 0 through 9
recursion
arithmetic system that uses the digits 0 through 9
byte
arithmetic system that uses the digits 0 through 9
EBCDIC
arithmetic system that uses the digits 0 through 9
binary system
arithmetic system that uses the digits 0 through 9
enumerator
arithmetic system that uses the digits 0 through 9
decimal system
arithmetic system that uses the digits 0 through 9
bit
arithmetic system that uses the digits 0 through 9
mask
arithmetic system that uses the digits 0 through 9
enumeration
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
51
Match between columns
arithmetic system that uses only 1s and 0s
recursion
arithmetic system that uses only 1s and 0s
byte
arithmetic system that uses only 1s and 0s
EBCDIC
arithmetic system that uses only 1s and 0s
binary system
arithmetic system that uses only 1s and 0s
enumerator
arithmetic system that uses only 1s and 0s
decimal system
arithmetic system that uses only 1s and 0s
bit
arithmetic system that uses only 1s and 0s
mask
arithmetic system that uses only 1s and 0s
enumeration
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
52
Match between columns
named constant in an enumeration
recursion
named constant in an enumeration
byte
named constant in an enumeration
EBCDIC
named constant in an enumeration
binary system
named constant in an enumeration
enumerator
named constant in an enumeration
decimal system
named constant in an enumeration
bit
named constant in an enumeration
mask
named constant in an enumeration
enumeration
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
53
Match between columns
programmer-defined set of integer constants represented by identifiers
recursion
programmer-defined set of integer constants represented by identifiers
byte
programmer-defined set of integer constants represented by identifiers
EBCDIC
programmer-defined set of integer constants represented by identifiers
binary system
programmer-defined set of integer constants represented by identifiers
enumerator
programmer-defined set of integer constants represented by identifiers
decimal system
programmer-defined set of integer constants represented by identifiers
bit
programmer-defined set of integer constants represented by identifiers
mask
programmer-defined set of integer constants represented by identifiers
enumeration
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.