C++ - Sample Interview Question (Senior Level)

What will be the result of compiling and running the following code?


#include <iostream>

using namespace std;

namespace GloablBanks
{
   struct BankAccount
   {
   };
   void createAccount(const BankAccount&)
   {
   cout<<"Bank NameSpace";
   }
}

struct BankAccount
{
};
void createAccount(const BankAccount&)
{
cout<<"No NameSpace";
}

GloablBanks::BankAccount account;

int main()
{
   createAccount(account);  
}

  1. No NameSpace
  2. No output
  3. Bank NameSpace
  4. There will be linkage errors
  5. None of the above
Tests in C++ for Seniors

Test Name Difficulty Time (minutes) No. of Questions
C++ Online Test for Seniors C++ Senior 60 30

More Specific Tests in C++ for Seniors

Test Name Difficulty Time (Minutes) No. of Questions
C++-Basics Online Test for Seniors C++ - Basics Senior 20 10
C++-Object-Oriented-Programming Online Test for Seniors C++ - Object Oriented Programming Senior 20 10
C++-Advanced-Concepts Online Test for Seniors C++ - Advanced Concepts Senior 20 10
C++-STL Online Test for Seniors C++ - STL Senior 20 10
C++-Standard-Library Online Test for Seniors C++ - Standard Library Senior 20 10
C++-Compound-Data-Types Online Test for Seniors C++ - Compound Data Types Senior 20 10