Skip to content
Related Articles

Related Articles

Improve Article

Adobe Interview Experience | 4 Years Experienced

  • Last Updated : 18 Jul, 2021

Technical Round(1 hr): C++ problems asked in this round

  1. C++ Output-Based problems:

    C++




    class Base{
        public:
        Base(){
            cout<<"base called ";
        }
    };
      
    class Derived{
        Base b;        
        public:
        Derived(){
            cout<<"derived called\n";
        }
    };
      
    int main(){
        Derived d;       
        return 0;
    }

    What will be the output and why?

  2. new and delete concept related problem. Print output in below code

    C++




    class Derived {
        int id;
    public:
        Derived(int id)
        {
            this->id = id;
            cout << "derived const for id:" << id;
        }
        ~Derived() { cout << "derived dest. for id" << id; }
    };
      
    int main()
    {
        Derived d(5);
        Derived* d1 = new Derived(10);
        delete d1;
        return 0;
    }

  3. Override concept related question

    C++




    class Base{
        public:
        void show(int x){
            cout<<"base called x="<<x<<endl;
        }
    };
      
    class Derived: public Base{
        public:
        void show(float x){
            cout<<"derived called x="<<x<<endl;
        }
    };
      
    int main(){
        Derived d;
        d.show(10);      //which func. will be called? 
        d.Base::show(10);  //also asked to write code to call to Base class show func.
        return 0;
    }

  4. Ref concept related problem. Complete following code, so that instance of class A can be created correctly.

    C++




    class A {
        int& m_ref;
    };
      
    int main() {
        A a;
        return 0;
    }

  5. We need to create our own string class, which should behave similar to c++ string class. Write all necessary constructors and destructor for that.
  6. Also asked when initialization list should be used and when not?
  7. What’s the need to move semantics?
  8. https://medium.com/swlh/write-your-own-c-stl-string-class-e20113a8de79

Technical Round 2 (1hr 30 mins):

  1. Empty class concept program. Will below prog. work fine?

    C++




    class A {
    };
      
    int main()
    {
        A a1;
        A* a2= new A(); // as size of empty class object is 1
                       // byte. So, it should be deallocated also
        return 0;
    }

  2. Given an array and k. find minimum no. of corner elements required to make their sum=k
    arr[]={1,2,3,4,6,2,3,1} 
    k=6

    ans=3

    First told brute force approach of backtracking. O(pow(2,n));

    I provided solution similar to approach discussed here: https://www.geeksforgeeks.org/maximize-sum-of-k-elements-in-array-by-taking-only-corner-elements/

  3. https://leetcode.com/problems/course-schedule-ii/

    Asked about space and time complexity.



    https://www.geeksforgeeks.org/topological-sorting-indegree-based-solution/

    Also, asked about dif. b/w BFS and DFS

Technical Round 3 (1 hr):

  1. https://www.geeksforgeeks.org/sort-array-converting-elements-squares/. Told optimised approach to solve this
  2. https://www.geeksforgeeks.org/check-if-a-word-exists-in-a-grid-or-not/  I solved it using visited array. Interviewer asked about space and time complexity.

    I told time complexity->(n*m)^2,

    space complexity->n*m due to visited matrix. Asked to solve problem without using visited matrix.

  3. Asked about lamda expressions.

    Asked If I do know about callback, in my company projects, if I have ever used callback.

    Then he asked to complete a class implementation

    C++




    class SignalDispatcher{
    public:
        //callbackFunc is lamda expr of format   [](mystrut data){}
        void on(string eventName, std::function<void(mystruct)> callbackFunc) 
        //call all callbacks with this eventname and put data as argument  
        void trigger(string eventName, mystrut data)    
    };

    Told hashmap and vector approach to store callbacks and then call them

    Also, asked to tell unit test cases for this code.

  4. Implement own generic vector class with 3 funcs push_back(), pop_back(), size()

Managerial Round 1 (~1hr 20 mins):

  1. Write a macro to find max of 3 numbers.

    Asked about pros and cons of Macros.  https://www.geeksforgeeks.org/macros-vs-functions/

    considering cons of macros, is there any other way to skip context switching? inline functions

  2. Output based problem

    C++




    int a[6] = {0, 1, 2, 3, 4, 5};
    cout<<a[0];    
    cout<<1[a];      
    cout<<*(a+2);    
    cout<<*(3+a):  
    cout<<*a+4;      
    cout<<a[-1];    
    cout<<a[6];

  3. What is Little Endian and big endian. Write program to check endianess of machine  https://www.geeksforgeeks.org/little-and-big-endian-mystery/
  4. Asked if I am familiar with bitwise operator. How to check if number is even or odd?
  5. Asked about which design patterns I have used? explain observer design pattern.
  6. Design class structure of snake and ladder game. Cross questions on space and time complexity

Managerial Round 2 (~1 hr):

  1. https://www.geeksforgeeks.org/reverse-words-in-a-given-string/

    first told stack-based approach and then reduced space complexity to O(1)

  2. https://www.geeksforgeeks.org/print-nodes-top-view-binary-tree/

    As I told about using map, asked about map internal implementation. I told that and then asked to write code for put() and get() api.

    I write code without managing height, interviewer asked to write that as well, I was not able to do that.

    Also discussed on unordered_map and difference b/w both of them

Director Round (~30 mins):

  1. Asked about my projects. Lots of discussion on my company’s project.
  2. Asked to design system in which pdf files can be shared among multiple users and can be edited at same time by multiple users.

Final Verdict: Selected

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. GoogleE-Litmus and Microsoft Test Serieses.




My Personal Notes arrow_drop_up
Recommended Articles
Page :