← Quiz: C++ Introduction: all 10 questions
Quiz: C++ Introduction · Question 10 of 10
Why is using namespace std; avoided in header files?
Why is using namespace std; avoided in header files?
- A.It makes the program run slower
- B.Header files cannot contain using statements
- C.Every file that includes the header gets all std names, which can clash with its own names
- D.It disables cout and cin
Answer & explanation
Correct answer: Every file that includes the header gets all std names, which can clash with its own names
In a single .cpp file it is a convenience; in a shared header it forces the choice on everyone.
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 →