🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: C++ Introduction: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. What does this print? (code)
  2. Q2. Which reads a full line including spaces into a string s?
  3. Q3. What does this print? (code)
  4. Q4. In which namespace do cout and string live?
  5. Q5. What does for (auto& x : v) x = 2; do?
  6. Q6. What does this print? (code)
  7. Q7. The user types Ravi Kumar for the statement cin name; (name is a string). What does name hold?
  8. Q8. What does this print? (code)
  9. Q9. What type does auto x = 3.5; give x?
  10. Q10. Why is using namespace std; avoided in header files?