Explore topic-wise MCQs in Computer Science.

This section includes 3 Mcqs, each offering curated multiple-choice questions to sharpen your Computer Science knowledge and support exam preparation. Choose a topic below to get started.

1.

We can output text to an object of class ofstream using the insertion operator « because

A. the ofstream class is a stream
B. the insertion operator works with all classes
C. we are actually outputting to cout
D. the insertion operator is overloaded in ofstream
Answer» E.
2.

A class named student must have a constructor whose name is

A. student
B. ~student
C. constructor
D. any legal C++ name.
Answer» B. ~student
3.

Which of the following C++ expressions is equivalent to the mathematical expression 5 ?

A. 5 ^ 3
B. cube(5)
C. pow (3, 5)
D. pow(5, 3)
E. sqrt (5, 3)
Answer» E. sqrt (5, 3)