🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C++ Introduction: all 10 questions

Quiz: C++ Introduction · Question 7 of 10

The user types Ravi Kumar for the statement cin name; (name is a string). What does name hold?

The user types Ravi Kumar for the statement cin >> name; (name is a string). What does name hold?

  1. A."Ravi Kumar"
  2. B."Kumar"
  3. C."Ravi"
  4. D.An empty string
Answer & explanation

Correct answer: "Ravi"

cin >> stops reading at the first space; use getline to read the whole line.

Can you get the rest right without peeking?

Take the timed Quiz: C++ Introduction quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →