Skip to content
Related Articles

Related Articles

Cadence Interview Experience for SDE-2 | 3.5 Years Experienced

Improve Article
Save Article
  • Last Updated : 23 Jun, 2021
Improve Article
Save Article

Technical Round 1(1 hr):

  1. Interviewer tried to know how I gained experience in C/C++, what kind of work has been done in C/C++, my major role in that.
  2. Then asked to write APIs for some scenarios related to my project.  

Technical Round 2(1 hr):

  1. Asked if I know about multithreading, I said no
  2. Asked if I know Memory corruption, I said no
  3. Code to allocate memory of 4 bytes,

    void* ptr= malloc(4);

    Then asked to allocate memoy of 4 bytes using int data type

    void* ptr= malloc(sizeof(int));

    Then asked if I can write “abcd” on these 4 bytes of memory, like ‘a’ on first byte and so on.


    void initializePtr(void* ptr){
        char* cptr=(char*)ptr;
        char ch='a';
        for(int i=0; i<4; i++){

  4. Suppose, We have started a company that maintains db of its client. client’s data is managed using linked list. But searching any data is very slow. How can we make search efficient like search by name?

    Suggested to use Trie for search by name and map to search by certain filters.

    Then he asked, which map will be used, explained both map and unordered_map and their implementation. Also, asked about difference b/w unordered_map and unordered_multimap.

    But there was constraint on memory, we can’t increase memory more than that. Suggested to maintain sorted linked list as per priority.

    I think using SkipList would be a better solution.


Technical Round 3(1 hr):


    I told approach using a flag for left/right child. He asked to do it without flag, then told approach of checking node’s left child if that is leaf or not. I did it using a sum argument, but he asked to do it using local sum variable. implemented that also.

  3. What is merge sort and code its implementation

Technical Round 4(1 hr):

  1. Problem to implement musical chair game. We need to get random chair and then need to delete it, both operations in O(1). Which data structure will be used, linked list or array? Similar to: But Musical chair can be implemented without map also.

    I told approach of two pointers to place odd elements together and even together and after that sort twice.

    He then asked to use only one sort call and asked to write comparator for the same.


    bool compare(int x, int y){ 
                if(x<y) return true;
                else return false;
            } else {
                return true;
        } else {
                return false;
            } else {
                if(x>y) return true;
                else return false;

  3. Suppose given a string, 463. Add parenthesis in output string as per count of elements:

    I told approach of keeping count of opened parenthesis and then add start or end parenthesis accordingly.

  5. There is a car sensor which is continuously sensing temperature and giving temperature. Sensor’s output is our input and at any time we are asked if a particular number is reached or not, then we need to tell YES/NO.

    I told approach of using set. we will store all numbers in set.

    Then he added fault of 5% in sensor’s output. suppose, actual temperature was 5 but sensor output it as 4.95. Then how will we do it. I told approach of using BST. For any particular x, we check if root->data >=x-5/100 and root->data <=x+5/100, then we will return true otherwise traverse left and right tree.

  6. We are at alien earth, whose number system is different than us. We are given array of numbers and we need to sort it. We are given an API to compare 2 numbers. Achieve target in minimum no. of API calls. Also, associativity is maintained. if we know that 1>2 and 2>3, then 1>3.

    I first told insertion approach and then merge sort approach.

    It would be highly appreciated if readers can share correct solution for this.

  7. Given a single linked list. Write code to delete node from singly linked list. Interviewer asked to write correct code without any mistake.

Director Round(1 hr):

  1. Asked about previous rounds how they all went, also asked that what was asked in all previous interviews.
  2. Asked if I have studied about compiler design and OS in my college. If I know how things work internally. Sbrk calls etc.
  3. How to check if our program is taking long time and if it’s consuming more memory.

    Also asked about my project code size and which approach we use in our code for checking timing issues and memory issues.

  4. For memory issues, asked to design our own product to detect memory leaks.

    I told approach of keeping info. of all dynamically allocated memories on heap through malloc or new. then if they are not deallocated in the scope, consider it as memory leak. But interviewer said that dealloc memory outside scope is also fine. So, I told to check memory dealloc at the end of the program.

    He said that if initially, we took 100 mb of memory and later state 10mb is deallocated, then how it would be done. I told to check how much meory is deallocated out of allocated memory at the time of freeing memory.

  5. Suppose a 8GB program and we have 32 GB and 32-bit system. Will the system be able to run that program?

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!