OOP Pillars With a Live Class round·Engineering·Medium·20 min

TCS Ninja Technical Interview — OOP Pillars With a Live Class

20 min · 1 credit · scorecard at the end
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.

  1. 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.

Oop Example Grounding
Whether each concept comes with a concrete example from code you wrote, not a recited car or animal definition.
25%
Overloading Vs Overriding Precision
How cleanly you split compile-time overloading from runtime overriding, with a real example of each.
20%
Dynamic Dispatch Reasoning
Whether you can explain why a method is virtual in terms of which version runs through a base pointer at runtime.
20%
Live Class Hierarchy Correctness
How correctly you draw the Shape hierarchy and direction of is-a, and defend it when the arrows are questioned.
15%
Project Connection
Whether you connect OOP concepts to specific decisions in your own final-year project rather than theory alone.
12%
Compose Under Pushback
Whether you stay calm and reason through challenges instead of getting defensive or guessing when questioned.
8%

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

What does the TCS Ninja OOP technical round actually test?
It tests whether you understand object-oriented programming as working knowledge, not memorised definitions. The interviewer asks for the four pillars, encapsulation, abstraction, inheritance and polymorphism, then immediately asks for a real example and where you used the concept in your own project. You will be asked to draw a small class hierarchy, for example a Shape base class with Circle and Rectangle, and reason about why a method is virtual. Expect probes on overloading versus overriding, abstract class versus interface, constructors, and the diamond problem in C plus plus and Java.
How should I structure my answer to an OOP pillar question?
Lead with one plain sentence of definition, then immediately give a concrete example, then say where you used it in a project. For polymorphism, separate compile-time, which is method overloading, from runtime, which is method overriding, before the interviewer asks. Keep the definition short because the interviewer accepts it in two seconds and then pushes for the example. The example and the project use are where the marks are. Avoid the overused car and animal examples and reach for something from code you actually wrote.
What are the most common mistakes in this round?
The biggest mistake is reciting the four pillars as a flat list with no example. The second is confusing method overloading with method overriding. The third is claiming you know a concept and then going blank when asked where you used it in your project. Candidates also lose ground when they cannot say why a method should be virtual or what changes if the keyword is removed, and when they cannot explain why Java does not support multiple inheritance. Long unrelated answers that do not address the question asked also hurt.
How is this AI interviewer different from a real TCS interviewer?
It behaves like a real TCS campus panelist named Anand. It accepts a definition for a moment, then asks for a real example and a project use, exactly as a human panelist does. It probes every answer at least once before moving on, never gives you the answer, and never praises you mid-interview. Unlike a stressed real loop it gives equal time and stays calm, but it will gently play dumb and ask but why to test whether your understanding is real or borrowed from a prep PDF.
How is scoring done in this practice round?
Your responses are scored against observable signals, not delivery style or accent. The scorecard looks at whether each pillar came with a concrete example, whether you separated overloading from overriding, whether your live class hierarchy was correct and you could justify the virtual method, and whether you connected concepts to your own project. After the session you get a transcript-backed report naming the specific concept you could define but not demonstrate, so you know exactly what to drill before the real interview.
What should I do in the first two minutes?
Recall the four pillars in order so the opening question is instant: encapsulation, abstraction, inheritance, polymorphism. Have one real example ready for each that is not a car or an animal. Pull up a mental sketch of a Shape base class with Circle and Rectangle and an area method so you can draw it fast when asked. Identify one place in your final-year project where you used a class, inheritance, or an interface, because the where did you use this follow-up is guaranteed. Stay calm and answer the exact question asked.
How do I handle the draw a class hierarchy on the whiteboard request?
Start on the whiteboard within the first turn rather than narrating. Draw a Shape base class at the top with an area method, then Circle and Rectangle below it with arrows pointing up to show they derive from Shape. Mark the area method as the one each subclass overrides. Be ready for the follow-up on why that method is virtual: in C plus plus the virtual keyword enables runtime dispatch so the correct subclass area runs through a base pointer. If asked what happens when you remove virtual, explain that the call binds to the base version at compile time instead.
What does a strong answer sound like in this round?
A strong answer reaches for a concrete example before being asked. On polymorphism it says compile-time polymorphism is method overloading and runtime polymorphism is method overriding, with a one-line example of each. On the Shape hierarchy it explains that area is virtual so a base class pointer calls the correct subclass version at runtime, and that removing virtual makes the call bind statically to the base. On the diamond problem it knows C plus plus uses virtual inheritance and Java avoids it with interfaces. And it always lands on where the candidate used the idea in their own project.
Does TCS ask OOP questions in C plus plus or in Java?
Both. Candidates may answer in whichever language they are comfortable with, and the interviewer often probes the difference between the two. Common cross-language probes include the difference between C and C plus plus, why Java does not support multiple inheritance while C plus plus does, how the diamond problem is handled in each, and the difference between C plus plus destructors with manual cleanup and Java object lifecycle with garbage collection. Pick the language you wrote your project in and be ready to contrast it with the other when asked.
How important is connecting OOP concepts to my project?
It is the single most decisive signal. Reported TCS Ninja experiences show interviewers consistently push from definition to example to project use. Demonstrating where you used a class, inheritance, an interface, or polymorphism in your final-year project strengthens the answer far more than a perfect textbook definition. If you cannot connect any OOP concept to your own work, the interviewer reads the knowledge as borrowed. Before the round, map at least two concepts to specific decisions you made in your project code.

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.