Tech Mahindra

 Move constructor

types of constructors

overload standard output constructor to print 

   friend ostream& operator<<(ostream&, Fraction& c)
    {
        cout << c.numerator << "/" << c.denominator;
        return cout;
    }

Find duplicates in a vector 

#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <algorithm>
using namespace std;
int main()
{
  std::map<int, int> m;
  std::vector v{1,2,3,55,55,4,5};
  for(auto &x:v)
  {
      m[x]++;
  }
  for(auto &[key,value]:m)
  {
      if(value > 1)
       std::cout << key <<std::endl;
  }
}


int main()
{
  std::vector<char*> v;
  std::string str[4] = { "hello" , "world", "hi", "howareyou"};
  for(auto &x: str)
  {
      v.push_back(x.c_str());
  }
  v.push_back("whatareyou");
}


C++11 vs C++14 vs C++17

Types of SIP messages

Map insertion deletion traversal

Singleton pattern

" hello world how are you " --> Write a program to get the last string "you"




Comments

Popular posts from this blog

GlobalLogic Interview

Motorola(Dynamic Technologies) Kolkata

Euronet interview questions