Open In App

Cadence Interview Experience for SDE-2 | 3.5 Years Experienced

Improve
Improve
Like Article
Like
Save
Share
Report

Technical Round 1(1 hr):

  1. Default functions provided by compiler in empty class? https://www.geeksforgeeks.org/default-methods-in-c-with-examples/
  2. Which data structure you will use to represent a directory structure? Tree

    Write program to count files with a given name like “abc.txt”

  3. What are static variables, where are they stored? Data segment area
  4. Detect cycle in directed graph. Told DFS approach
  5. What is reference in C++.

    Find out mistakes in below code.

    C++




    int main() {
      
       int x=5;
      
       int &ptr=x;
      
       ++ptr;
      
       cout<<ptr;  //what will be printed?
      
       delete ptr;  //compilation error  
      
        return 0;
      
    }

    
    

  6. New and delete operator syntax related question, also checked for memory leak scenario when variables are allocated dynamically
  7. Delete 4th item from single linked list
  8. What are Dynamic and static linked libraries? Do you know about .so files?
  9. How to make global variables accessible in different classes? Using extern variable
  10. What is heap memory.
  11. What are function pointers and why are they used?
  12. What design patterns do you know? Design pattern you have used in your code.
  13. Use runtime polymorphisms in your code. Why it is required?

Technical round 2(1 hr):

  1. Pros and cons of both C and C++ over each other.
  2. One problem with sorting. Given following class:

    C++




    class Apple{
    private:
     int weight;
     enum color ; //black, green , red
    };

    
    

    You have a bunch of apples, need to sort them with these criteria.

    1) Red Good apples – Heavy to lighter

    2) Green apples – Heavy to lighter

    3) Bad – Heavy to lighter

  3. Provided some code and asked if it’s copy constructor or assignment function call
  4. What will happen if we don’t return anything from assignment operator?

    https://stackoverflow.com/questions/42335200/assignment-operator-overloading-returning-void-versus-returning-reference-param

    Also asked about rvalue concept.

  5. What is STL? How many types of iterators in C++?
  6. Difference b/w vector and list?

Director Round(1 hr):

  1. Coin Puzzle: https://stackoverflow.com/questions/34057683/strategy-to-win-game-if-players-can-take-upto-4-coins

    I told answer. Then he asked me to pick coins accordingly and checked at each step how many coins are picked by me.

  2. Variation in question 1, player who picks last coin loses the game.
  3. Given a file, read that file and print last 10 lines of file. Suppose file having 25 lines. Print lines from 16 to 25. Told queue approach
  4. Why do you want to switch?


Last Updated : 28 May, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads