Cadence Interview Experience for SDE-2 | 3.5 Years Experienced
Technical Round 1(1 hr):
- Default functions provided by compiler in empty class? https://www.geeksforgeeks.org/default-methods-in-c-with-examples/
- Which data structure you will use to represent a directory structure? Tree
Write program to count files with a given name like “abc.txt”
- What are static variables, where are they stored? Data segment area
- Detect cycle in directed graph. Told DFS approach
- What is reference in C++.
Find out mistakes in below code.
//what will be printed?
- New and delete operator syntax related question, also checked for memory leak scenario when variables are allocated dynamically
- Delete 4th item from single linked list
- What are Dynamic and static linked libraries? Do you know about .so files?
- How to make global variables accessible in different classes? Using extern variable
- What is heap memory.
- What are function pointers and why are they used?
- What design patterns do you know? Design pattern you have used in your code.
- Use runtime polymorphisms in your code. Why it is required?
Technical round 2(1 hr):
- Pros and cons of both C and C++ over each other.
- One problem with sorting. Given following class:
//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
- Provided some code and asked if it’s copy constructor or assignment function call
- What will happen if we don’t return anything from assignment operator?
Also asked about rvalue concept.
- What is STL? How many types of iterators in C++?
- Difference b/w vector and list?
Director Round(1 hr):
- 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.
- Variation in question 1, player who picks last coin loses the game.
- 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
- Why do you want to switch?
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. Google and Microsoft Test Serieses.