1. Home
  2. Computer Science MCQs
  3. C++ and Object-Oriented Programming
  4. Which standard header must be included to use std::cout…

Added 30 Nov -0001

Which standard header must be included to use std::cout and std::cin in C++?

  1. <streambuf>
  2. <string>
  3. <iomanip>
  4. <iostream> Correct answer

Correct answer

D. <iostream>

16 views

MCQSEXAM

Explanation

<iostream> declares the standard stream objects cout, cin, cerr and clog together with the insertion and extraction operators. <fstream> adds file streams, <iomanip> adds manipulators such as setw, and <string> adds std::string, though none of these supplies cout. Including only <string> is a common beginner error that produces an undeclared-identifier message for cout.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C++ and Object-Oriented Programming MCQs

Practise all C++ and Object-Oriented Programming MCQs

Similar MCQs