🎙 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 10 of 10

Why is using namespace std; avoided in header files?

Why is using namespace std; avoided in header files?

  1. A.It makes the program run slower
  2. B.Header files cannot contain using statements
  3. C.Every file that includes the header gets all std names, which can clash with its own names
  4. 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 →