Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which C++ header file must be included to use cout and cin objects?

  1. <iostream>

  2. <istream>

  3. <ostream>

  4. <stdio.h>

The correct answer is: <iostream>

To use cout and cin objects in C++, the <iostream> header file must be included. This header file contains the definitions of the standard input/output stream objects, including cout and cin. Option B, <istream>, only contains the definition for the standard input stream object, so it is not the correct answer. Option C, <ostream>, only contains the definition for the standard output stream object, so it is also not the correct answer. Lastly, option D, <stdio.h>, is a header file for the C programming language and does not contain the definitions for cout and cin in C++, making it an incorrect answer. Therefore, the correct answer is A, <iostream>.