Practice Test: Question Set - 23
1. Which of the following assigns the number 5 to the area variable?
- (A) area 1 = 5
- (B) area = 5
- (C) area
== 5
- (D) area
--> 5
2. Which of the following is NOT included in the header of a function?
- (A) The
type of variable returned by the function to the function that calls it
- (B) The
name of the program or function that calls the function
- (C) The
name of the function
- (D) The
types and names of any variables that will be passed to the function
3. The switch variable can be of
- (A) int
type only
- (B) char
type only
- (C) Both
int as well as char type
- (D) Float
type only
4. Using the wardrobe structure within the ShopList structure is an example of a good programming principle, known as _______
- (A) Reusability
- (B) Polymorphism
- (C) Redundancy
- (D) Recursion
5. The major advantage of data hiding is that ________
- (A) Your
programs can include more data
- (B) You no
longer need functions
- (C) No
one can ever use your data
- (D) Your data
will be used correctly
6. When all of the operations in a function contribute to the performance of only one task, a function has
- (A) Singular
cohesion
- (B) Tight
cohesion
- (C) Functional
cohesion
- (D) Sequential
cohesion
7. A default catch block catches
- (A) All
thrown objects
- (B) No
thrown objects
- (C) Any
thrown object that has not been caught by an earlier catch block
- (D) All
thrown objects that have been caught by an earlier catch block
8. If a class object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is_________
- (A) A
parent class of the thrown class
- (B) A
child class of the thrown class
- (C) Either (a)
or (b)
- (D) Neither (a)
nor (b)
9. Machine code is _______
- (A) Edited code
- (B) Source code
- (C) The
0s and 1s that the computer can understand
- (D) Both (b) and
(c)
10. Which of the following are valid characters for a numeric literal constant?
- (A) A
comma
- (B) A dollar
sign ($)
- (C) A percent
sign (%)
- (D) None
of the above
11. Which of the following is the scope resolution operator?
- (A) ->>
- (B) ::
- (C) *
- (D) &
12. Which of the following statements creates and initializes a pointer named salesPtr?
- (A) salesPtr =
NULL;
- (B) *salesPtr =
"";
- (C) float
&salesPtr = NULL;
- (D) float
*salesPtr = NULL;
13. Which type of statement does not occur in computer programs?
- (A) Sequence
- (B) Loop
- (C) Denial
- (D) Selection
14. One way in which a structure differs from an array is that
- (A) A structure
may have members of more than one type
- (B) A
structure must have members that are all the same type
- (C) An
array may have members of more than one type
- (D) There
is no difference between a structure and an array
15. Inheritance is the principle that
- (A) Classes
with the same name must be derived from one another
- (B) Knowledge
of a general category can be applied to more specific objects
- (C) C++
functions may be used only if they have logical predecessors
- (D) One
function name may invoke different methods
Next Tests: