← 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 →- Q1. What does this print? (code)
- Q2. Which reads a full line including spaces into a string s?
- Q3. What does this print? (code)
- Q4. In which namespace do cout and string live?
- Q5. What does for (auto& x : v) x = 2; do?
- Q6. What does this print? (code)
- Q7. The user types Ravi Kumar for the statement cin name; (name is a string). What does name hold?
- Q8. What does this print? (code)
- Q9. What type does auto x = 3.5; give x?
- Q10. Why is using namespace std; avoided in header files?