Object Oriented Programming Using C++ – Section 9

46. Which of the following statements opens a file named temp.dat for output?

A. outFile.open(“temp .dat”);
B. fileOut.output(“temp .dat”);
C. openFile.out(“temp .dat”);
D. fileOpen.out(“temp .dat”);
E. out.fileOpen(“temp .dat”);

Correct Answer:   A. outFile.open(“temp .dat”);
Advertisement

47. Which of the following will store the letter H in a Character variable named initial?

A. initial = ‘H’
B. initial = ‘H’;
C. initial = “H”
D. initial = “H”;

Correct Answer:   B. initial = ‘H’;
Advertisement

48. Compared with the classes from which they are derived, inherited classes may have _____

A. additional data members
B. additional member functions
C. both (a) and (b)
D. neither (a) nor (b)

Correct Answer:   C. both (a) and (b)
Advertisement

49. A class named Student must have a constructor whose name is

A. Student
B. ~Student
C. constructor
D. any legal C++ name

Correct Answer:   A. Student
Advertisement

50. To write data that contains variables of type float, to an object of type ofstream, you should use

A. the insertion operator
B. seekg()
C. writeQ
D. put()

Correct Answer:   C. writeQ
Advertisement

Leave A Comment?