Object Oriented Programming Using C++ – Section 8

31. Which of the following formulas can be used to generate random integers between 1 and 10?

A. 1 + rand() % (10 – 1 + 1)
B. 1 + (10 – 1 + 1) % rand()
C. 10 + rand() % (10 – 1 + 1)
D. 10 + rand() % (10 + 1)

Correct Answer:  A. 1 + rand() % (10 – 1 + 1)

32. Format flags may be combined using the _____

A. bitwise OR operator(|)
B. logical OR operator (||)
C. bitwise AND operator (&)
D. logical AND operator (&&)

Correct Answer:  A. bitwise OR operator(|)

33. Which of the following will store the number 320000 as a Float number?

A. counPop = (float) 3.2e5;
B. counPop = (float) 3.2e6;
C. counPop = (float) .32e5;
D. counPop = (float) .32e7;
E. counPop = (float) 3.2-e5;

Correct Answer:  A. counPop = (float) 3.2e5;

34. The arguments that determine the state of the cout object are called

A. classes
B. manipulators
C. format flags or state flags
D. state controllers

Correct Answer:  C. format flags or state flags

35. If a class will serve as a base class, most often the base class data members are

A. private
B. protected
C. public
D. polymorphic

Correct Answer:  C. public

Leave A Comment?

4 × 5 =