TCS Ninja Technical Interview — OOP Pillars With a Live Class
- Field
- Engineering
- Company
- Tata Consultancy Services
- Role
- Assistant System Engineer Trainee (Ninja)
- Duration
- 20 min
- Difficulty
- Medium
- Completions
- New
- Updated
- 2026-06-09
What this round is about
- Topic focus. The object-oriented programming slice of the TCS Ninja technical interview: the four pillars, overloading versus overriding, abstract class versus interface, constructors, the diamond problem, and a small class hierarchy you draw live.
- Conversation dynamic. The interviewer accepts a definition for a moment, then asks for a real example and for where you used the concept in your own project.
- What gets tested. Working understanding over memorised lines: can you show the idea in code and reasoning, not just recite it.
- Round format. About twenty minutes of voice conversation with a whiteboard where you sketch a Shape base class with Circle and Rectangle subclasses.
What strong answers look like
- Example before being asked. You follow a one-line definition with a concrete example that is not a car or an animal, then name where you used it in a project.
- Overloading versus overriding split cleanly. You say compile-time polymorphism is method overloading and runtime polymorphism is method overriding, with a one-line example of each.
- The virtual method justified. On the Shape hierarchy you explain that area is virtual so a base class pointer calls the correct subclass version at runtime, and what changes if you remove the keyword.
- Diamond problem grounded. You state that C plus plus uses virtual inheritance and Java avoids the problem with interfaces.
What weak answers look like (and how to avoid them)
- Flat list, no example. Reciting the four pillars with nothing concrete behind them: fix it by attaching one real example to each pillar as you say it.
- Overloading and overriding swapped. Mixing the two signals shaky fundamentals: anchor overloading to same name different parameters at compile time, overriding to a subclass replacing a base method at runtime.
- Borrowed knowledge. Claiming a concept and then going blank on where you used it: map two concepts to your own project code before the round.
- Answering a different question. Long unrelated detail instead of the question asked: answer the exact question first in one or two sentences, then expand.
Pre-interview checklist (2 minutes before you start)
- Recall the four pillars in order. Encapsulation, abstraction, inheritance, polymorphism, so the opening question is instant.
- Have a non-textbook example per pillar. Something from code you wrote, not a car or an animal.
- Pull up the Shape sketch. A base class with an area method and Circle and Rectangle deriving from it, ready to draw fast.
- Identify one project use. A class, an interface, or inheritance you actually used in your final-year project.
- Re-read overloading versus overriding. Be able to map each to compile-time and runtime in one breath.
- Recall the diamond problem split. Virtual inheritance in C plus plus, interfaces in Java.
How the AI behaves
- Probes every claim. After a definition it asks for a real example and for where you used it in a project, every time.
- No mid-interview praise. It will not say great answer or validate you; it acknowledges what you said and pushes deeper.
- Interrupts on recitation. If you recite without an example it stops and asks for one, and it may play dumb and ask but why to test real understanding.
- Pushes to the whiteboard. On the class question it directs you to sketch within the first couple of turns rather than narrate.
Common traps in this type of round
- Definition-only pillars. Reciting encapsulation and abstraction with no example or code behind them.
- Overloading and overriding confusion. Treating the two as the same thing or swapping their compile-time and runtime nature.
- Virtual hand-waving. Saying a method is virtual without explaining the runtime dispatch or what breaks when it is removed.
- Diamond blank. Knowing the phrase multiple inheritance but not how C plus plus and Java each resolve the ambiguity.
- Project disconnect. Being unable to point to a single place in your own work where you used an OOP idea.
- Defensive under pushback. Getting irritated when the interviewer questions your answer instead of staying calm and reasoning through it.
Sample problems you'll face
The problem below is the same one you'll work through in the live session — no surprises. Read the constraints carefully; the AI persona will refer you to the on-canvas card by problem number.
- 1Predict the output: virtual versus non-virtual area
Here is a small C plus plus program. Shape has an area method. In version A the area method is declared virtual; in version B the exact same code has the virtual keyword removed. A Shape pointer is made to point at a Circle object, and area is called through that pointer. Predict the output for version A and for version B, and mark which class's area method actually runs in each case.
Example inputclass Shape { public: virtual double area() { return 0.0; } }; // version B: remove 'virtual' class Circle : public Shape { double r; public: Circle(double x):r(x){} double area() { return 3.14*r*r; } }; int main(){ Shape* s = new Circle(2.0); cout << s->area() << endl; }Example outputVersion A (virtual): 12.56 -> Circle::area runs (runtime dispatch) Version B (no virtual): 0 -> Shape::area runs (static binding to the pointer type)- Assume standard C plus plus; ignore floating-point formatting and use 3.14 for pi.
- The only difference between version A and version B is the presence of the virtual keyword on Shape::area.
- Write the output line by line for both versions and mark which class's area method actually runs in each.
Interview framework
You will be scored on these 6 dimensions. The full rubric with definitions is below.
What we evaluate
Your final scorecard breaks down across these dimensions. The full rubric and tier criteria are revealed inside the interview itself.
- OOP Concept Example Grounding22%
- Polymorphism and Binding Precision20%
- Virtual Method and Dynamic Dispatch Reasoning20%
- Class Hierarchy Modeling on the Whiteboard16%
- Project Application Connection12%
- Inheritance Model and Abstraction Tradeoff Judgment10%
Common questions
Sources this interview is built on
Real candidate-report URLs (Glassdoor / AmbitionBox / PrepInsta / GeeksforGeeks / Medium) reviewed when authoring the questions, persona, and rubric. Verify the realism yourself.
- TCS Ninja Interview Questions | Interview Experience (2024) - InterviewBitinterviewbit.com
- TCS Ninja Interview Experience for 2026 Batch | PrepInstaprepinsta.com
- TCS Interview Experience Ninja On Campus 2025 - GeeksforGeeksgeeksforgeeks.org
- Diamond Problem in C++ - GeeksforGeeksgeeksforgeeks.org
- TCS Ninja Recruitment Process 2026 for Freshers | PrepInstaprepinsta.com