1. Home
  2. Computer Science MCQs
  3. C++ and Object-Oriented Programming
  4. How does operator>> on std::cin treat whitespace by default?

Added 30 Nov -0001

How does operator>> on std::cin treat whitespace by default?

  1. It reads a whole line including spaces
  2. It refuses input containing spaces
  3. It skips leading whitespace before reading Correct answer
  4. It keeps leading whitespace as data

Correct answer

C. It skips leading whitespace before reading

16 views

MCQSEXAM

Explanation

Formatted extraction uses the skipws flag, so leading whitespace is discarded before the value is parsed.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? 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