Posts

Infovision Labs

Process synchronization like pipe, fifo, fork, mmap , vfork etc. Producer- consumer problem (coding) #include <mutex> #include <memory> #include <iostream> #include <thread> #include <string> using namespace std; #define NA -128 int queue[50] = {NA}; int index = 0; int front_index =0; std::mutex m; void consumer() {   while(1)   {    unique_lock<std::mutex> lck(m);            if(front_index >= 0)       {       // then consume       front_index++;       std::cout << queue[front_index] <<endl;       queue[front_index] = NA;             }      else     {         break;     }   }  } void producer() {   while(1)   {     unique_lock<std::mutex> lck(m);     // wait for input   ...

LTI Mindtree Interview(Golang)

Interview question sources :- https://www.educative.io/courses/mastering-concurrency-in-go   What is a  fork-join model?  Write a program to fetch the common prefix in an array str1: ["flowbuilder", "flow", "flex"] output: "fl" if no common prefix print "" Types of channel in golang, what is buffered channel and unbuffered channel Write a go program to concurrently fetch data from multiple apis what is mutex?

IBM Coding challenge 1st round

Question:- Write a simple/basic TCP proxy CLI app. Requirements C++20 Use only Boost::asio Bonus if using asio coroutines Should work/run on at least one platform (macOS or Linux or Windows) Should not use or do anything that prevents it from building/running on the other platforms A single cpp file is fine (or a few separate cpp/hpp if needed) Bonus if providing a cross-platform CMake/conan project As small and minimal coding as necessary to get the job done Usage ./proxy <listen_port> <target_address> <target_port> I should be able to point this to a webserver (port 80) and then just do a curl or telnet locally (on the listen_port) and get the content of the webpage: ./proxy 12345 www.boost.org 80 And then on a separate terminal: curl http://localhost:12345/ should give me the same as curl http://www.boost.org/: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head>...

Payments companies

 Kiya.ai  Concentrix  Euronet American Express

Euronet interview questions

Some questions were from test4geeks  void GetSomeVariable(int **i) {    if(*i == NULL)    {       *i = new int;    }   **i = 20;   } int main() {    int someValue = 10;    GetSomeVariable(&someValue);    cout << someValue <<endl;        int *ptr = nullptr;    GetSomeVariable(&ptr);    cout << *ptr <<endl; } How to make the code compilable without changing GetSomeVariable? Solution: Use Function overloading or Type traits #include <iostream> #include <type_traits> void g(int*) { std::cout << 'L'; } void g(int**) { std::cout << 'R'; } template<typename T> void f(T t) {     if (std::is_same_v<T, int>) { std::cout << 1; }      if (std::is_same_v<T, int*>) { std::cout << 2; }      if (std::is_same_v<T, int**>) { std::cout <...

Euronet Objective/Coding Test

Euronet test --> Follow Java point MCQs (https://www.javatpoint.com/cpp-mcq-part-2#) Same questions found in https://mcqsets.com/downloads/download-c-mcq-questions-pdf/ Coding question 1 int main() {   vector<string> str;   str.push_back("Camel");   str.push_back("Horse");   str.push_back("Goat");      for(auto i= str.rbegin(); i != str.rend(); i++)   {      cout << *i <<std::endl; swap(str[0], *i);   }   cout << str[2] <<std::endl; } Coding question 2 number N is given as input , such that 1< = N <= 100, Find Number X such that X is divisible by N and sum of digits of X is equal to N (hint: X != N) Coding question 3 int main() {   std::ios::sync_with_stdio(false);   vector<int> v{2,3,4,2};      for(auto i: v)   {      i--;   }   for(const auto &i: v)   {      cout << i-1 <<std::en...