Object Oriented Programming Using C++ – Section 2

26. Which of the following statements uses the computer’s clock to initialize the random number generator?

A. srand(time);
B. srand(time(NULL));
C. time(srand);
D. time(srand(NULL));

Correct Answer:  B. srand(time(NULL));
Advertisement

27. A static data member is given a value

A. within the class definition
B. outside the class definition
C. when the program is executed
D. never

Correct Answer:  B. outside the class definition
Advertisement

28. You must provide a constructor for a derived class

A. always
B. if the base class constructor required arguments
C. if the base class constructor does not require arguments
D. never

Correct Answer:  B. if the base class constructor required arguments
Advertisement

29. If you want to override constructor default values for an object you are instantiating, you must also override

A. all other parameters to that constructor
B. all parameters to the left of that value
C. all parameters to the right of that value
D. no other parameters to that constructor

Correct Answer:  B. all parameters to the left of that value
Advertisement

30. To use one of the C++ built-in mathematical functions, you must include the _____ header file in your program

A. calculation.h
B. compute.h
C. expression.h
D. math.h
E. mathematical.h

Correct Answer:  D. math.h
Advertisement

Leave A Comment?