Home Interview Preparation TCS Interview Questions

TCS Interview Questions

by anupmaurya
TCS Interview Questions 2021 for freshers

Before starting with TCS Interview Questions, Let have a look at the background of Tata Consultancy Services (TCS).

Tata Consultancy Services (TCS) is an Indian multinational information technology services and consulting company, headquartered in Mumbai, Maharashtra, India. As of February 2021 TCS is the largest company in the IT sector in the world by Market capitalization of $169.2 billion It is a part of the Tata group and operates in 46 countries.

TCS is one of the largest Indian companies by market capitalization and one of the most trusted Indian brands worldwide. It alone generates 70% of the dividends of its parent company Tata Sons.

Recently, Tata Sons decided to sell stocks of TCS worth $1.25 billion in a bulk deal. In 2015, TCS was ranked 64th overall in the Forbes World’s Most Innovative Companies ranking, making it both the highest-ranked IT services company and the top Indian company.

Core values of TCS

Tata has always been a values-driven organization. These values continue to direct the growth and business of Tata companies.

The following are the core values of TCS:

  • Responsibility
  • Excellence
  • Integrity
  • Pioneering
  • Unity

Recruitment process in TCS

TCS conducts three rounds of interviews to select any fresher candidate as a software developer in their company.

  1. Aptitude test
  2. Technical interview
  3. HR interview

The recruitment drive of TCS starts with a written test followed by face to face interview. A recruiter may also conduct campus group discussion for software engineer candidates.

Questions related to Technical Round

Questions related to C/C++ programming language:

Question 1: How is C different from C++?
Answer: C++ can be said to be a superset of C. Major added features in C++ are Object-Oriented Programming, Exception Handling and rich C++ Library.

Question 2:Why is C called a mid-level programming language?

Answer: C is called a mid-level programming language because it binds the low level and high -level programming language. We can use C language as a System programming to develop the operating system as well as an Application programming to generate menu driven customer driven billing systems.

Question 3: Who is the founder of C language?
Answer: Dennis Ritchie

Question 4: What is the use of printf() and scanf() functions?

printf(): The printf() function is used to print the integer, character, float and string values on to the screen.

Following are the format specifier:

  • %d: It is a format specifier used to print an integer value.
  • %s: It is a format specifier used to print a string.
  • %c: It is a format specifier used to display a character value.
  • %f: It is a format specifier used to display a floating point value.

scanf(): The scanf() function is used to take input from the user.

Question 5: What is a static variable?
Answer: Static variables have a property of preserving their value even after they are out of their scope! Hence, static variables preserve their previous value in their previous scope and are not initialized again in the new scope.

Question 6: Are Variables in C static or Dynamic scoped?
Answer: Variables in C are always statically scoped.

Question 7: Explain the four storage classes in C?
Answer: Storage Classes are used to describe the features of a variable/function. The four storage classes in C are:

  1. auto: This is the default storage class for all the variables declared inside a function or a block.
  2. extern: Extern storage class simply tells us that the variable is defined elsewhere and not within the same block where it is used.
  3. static:This storage class is used to declare static variables which are popularly used while writing programs in C language.
  4. register: It declares register variables which have the same functionality as that of the auto variables.

Question 8: What do you mean by macros?

Answer: Macros are a piece of code in a program which is given some name. Whenever this name is encountered by the compiler, it replaces the name with the actual piece of code.

Question 9: What are structures in C?

Answer: A structure is a user-defined data type in C/C++. A structure creates a data type that can be used to group items of possibly different types into a single type.

Question 10: What is the difference between call by value and call by reference in C?
Answer: Following are the differences between a call by value and call by reference are:

ContextCall by valueCall by reference
DescriptionWhen a copy of the value is passed to the function, then the original value is not modified.When a copy of the value is passed to the function, then the original value is modified.
Memory locationActual arguments and formal arguments are created in separate memory locations.Actual arguments and formal arguments are created in the same memory location.
SafetyIn this case, actual arguments remain safe as they cannot be modified.In this case, actual arguments are not reliable, as they are modified.
ArgumentsThe copies of the actual arguments are passed to the formal arguments.The addresses of actual arguments are passed to their respective formal arguments.

Question 11 :What is virtual function and pure virtual function?


Virtual function:- To achieve polymorphism, function in base class is declared as virtual. By state virtual, we make a base class pointer to execute the purpose of any derived class depending on the content of the pointer (any acquired class address).Pure Virtual Function:- This is the function used in base class, and its definition has to be provided in derived class, In other pure virtual function has no definition in the base is declared as :

virtual void fun()=0;

It means that this function is not going to do anything, In case of pure virtual function derived function has to implement a pure virtual function or redeclare it as a pure virtual function

Question 12: Write a program to reverse an array or string.
Program to reverse an array using recursive technique.

//Program to reverse an array using recursive technique
#include <iostream>
using namespace std;
void revereseArrayIt(int arr[], int start, int end){
   while (start < end){
      int temp = arr[start];
      arr[start] = arr[end];
      arr[end] = temp;
int main() {
   int arr[] = {6, 9, 1, 4, 0, 5};
   int n = sizeof(arr) / sizeof(arr[0]);
   cout<<"Orignal Array : ";
   for (int i = 0; i < n; i++)
      cout<<arr[i]<<" ";
      revereseArrayIt(arr, 0, n-1);
      cout << "Reversed array : ";
      for (int i = 0; i < n; i++)
         cout<<arr[i]<<" ";
   return 0;


Orignal Array : 6 9 1 4 0 5  
Reversed array : 5 0 4 1 9 6 

Questions related to OOPs

Question 1: What are the main concepts of Object Oriented Programming?

Answer: Object-Oriented Programming or OOPs refers to languages that uses objects in programming. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function. Main concepts of OOP are:

  • Polymorphism
  • Inheritance
  • Encapsulation
  • Abstraction

Question 2: What are classes and objects?
Answer: Classes and Objects are two major aspects of Object Oriented Programming:
Class: A class is a user defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type.
Object: An Object is an identifiable entity with some characteristics and behavior. An Object is an instance of a Class. When a class is defined, no memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated.
Question 3: What are different types of Inheritance?
Answer: Types of Inheritance:

  1. Single inheritance
  2. Multiple Inheritance
  3. Multi-level Inheritance
  4. Hierarchical Inheritance
  5. Hybrid Inheritance

Question 4: Differentiate Function Overloading and Function Overriding.
Answer: Difference are as follows:

  • Function Overloading is when multiple function with same name exist in a class. Function Overriding is when function have same prototype in base class as well as derived class.
  • Function Overloading can occur without inheritance. Function Overriding occurs when one class is inherited from another class.
  • Overloaded functions must differ in either number of parameters or type of parameters should be different. In Overridden function parameters must be same.

Question 5: Give a real-life based implementation of Polymorphism.
Answer: Real life example of polymorphism, a person at the same time can have different characteristic. Like a man at the same time is a father, a husband, an employee. So the same person posses different behavior in different situations. This is called polymorphism.
Question 6: What are Access modifiers?
Answer: Access modifiers are used to implement an important feature of Object-Oriented Programming known as Data Hiding. Access Modifiers or Access Specifiers in a class are used to set the accessibility of the class members. That is, it sets some restrictions on the class members not to get directly accessed by the outside functions.
Question 7: Differentiate between a Structure and a Class.
Answer: A structure is the same as a class except for a few differences. The most important of them is security. A Structure is not secure and cannot hide its implementation details from the end-user while a class is secure and can hide its programming and designing details. For more details see Structure vs Class.
Question 8: Can a C++ class have an object of self type?
Answer: A class declaration can contain a static object of self type, it can also have a pointer to self type, but it cannot have a non-static object of self type.
Question 9: Why is the size of an empty class not zero in C++?
Answer: Size of an empty class is not zero. It is 1 byte generally. It is nonzero to ensure that the two different objects will have different addresses.
Question 10: What do you mean by a Friend class and a Friend function?
Friend Class: A friend class can access private and protected members of other classes in which it is declared as a friend. It is sometimes useful to allow a particular class to access private members of another class.
Friend Function: Like friend class, a friend function can be given special grant to access private and protected members.

Questions related to Java Programming Language

Question 1: How is Java platform independent?
Answer: The meaning of platform-independent is that the java compiled code(byte code) can run on all operating systems. Java codes are compiled and run on JVM and JVM is platform-independent and it is the reason why Java is able to become “Platform Independent”.
Question 2: Is the main method compulsory in Java?
Answer: Prior to JDK 7, the main method was not mandatory in a java program. However, from JDK7 main method is mandatory. The compiler will verify first, whether main() is present or not. If your program doesn’t contain the main method, then you will get an error “main method not found in the class”.
Question 3: Explain the difference between Interface and a class.
Answer: A class is a user-defined blueprint or prototype from which objects are created. It represents the set of properties or methods that are common to all objects of one type while an interface can also have methods and variables, but the methods declared in an interface are by default abstract (only method signature, no body). See Interface vs Class in Java.
Question 4: How to run java class file which is in different directory?
Answer: Classpath is the location from where JVM starts execution of a program. Similar to the classic dynamic loading behavior, when executing Java programs, the Java Virtual Machine finds and loads classes lazily (it loads the bytecode of a class only when the class is first used). The classpath tells Java where to look in the filesystem for files defining these classes.
Question 5: Why Java is not a purely Object-Oriented Language?
Answer: Java supports OOPs properties like Encapsulation, Inheritance, Polymorphism, Abstraction, etc. but it misses on some properties which makes it not a Pure Object Oriented Language.
Question 6: How are Java objects stored in memory?
Answer: In Java, all objects are dynamically allocated on Heap. This is different from C++ where objects can be allocated memory either on Stack or on Heap.
Question 7: What is Null Pointer Exception In Java?
Answer: NullPointerException is a RuntimeException. In Java, a special null value can be assigned to an object reference. NullPointerException is thrown when program attempts to use an object reference that has the null value.

Question 9: What is the difference between int array[] and int[] array?
Answer: There is no difference between array[] and []array. Both array[] and []array are the ways to declare an array. The only difference between them is that if we are declaring more than one array in a line, we should use prefix []. If we are declaring a single array in a line, we should use postfix []. For example, consider the following declaration:

int array1[], array2;   //array1[] is an array while array2 is just a variable of type int  
int [] arr1, arr2;  //both arr1 and arr2 are arrays of int type  

Question 10: What is the purpose of a default constructor?
Answer: The purpose of the default constructor is to assign the default value to the objects. The java compiler creates a default constructor implicitly if there is no constructor in the class.

Question 12:What are the main uses of this keyword?

Answer: There are the following uses of this keyword.

  • this can be used to refer to the current class instance variable.
  • this can be used to invoke current class method (implicitly)
  • this() can be used to invoke the current class constructor.
  • this can be passed as an argument in the method call.
  • this can be passed as an argument in the constructor call.
  • this can be used to return the current class instance from the method.

Question 13: Why does Java not support pointers?
Answer: The pointer is a variable that refers to the memory address. They are not used in Java because they are unsafe(unsecured) and complex to understand.

Question 14: What is super in java?
Answer: The super keyword in Java is a reference variable that is used to refer to the immediate parent class object. Whenever you create the instance of the subclass, an instance of the parent class is created implicitly which is referred by super reference variable. The super() is called in the class constructor implicitly by the compiler if there is no super or this.

Questions Related to DBMS

Question 1: What is the need of DBMS?
Answer: A Data Base Management System is a system software for easy, efficient and reliable data processing and management. It can be used for Creation of a database, Retrieval of information from the database, Updating the database and Managing a database. There are various other Needs of a DBMS.
Question 2: What is Data Abstraction and Data Independence?
Answer: Database systems comprise of complex data-structures. In order to make the system efficient in terms of retrieval of data, and reduce complexity in terms of usability of users, developers use abstraction i.e. hide irrelevant details from the users. This approach simplifies database design.
The main purpose of data abstraction is achieving data independence in order to save time and cost required when the database is modified or altered.
Question 3: What are interfaces in a DBMS?
Answer: A database management system (DBMS) interface is a user interface that allows for the ability to input queries to a database without using the query language itself. To learn more, visit Interfaces in DBMS.
Question 4: What is Database Schema?
Answer: The term “schema” refers to the organization of data as a blueprint of how the database is constructed (divided into database tables in the case of relational databases). The formal definition of a database schema is a set of formulas (sentences) called integrity constraints imposed on a database.
Question 5: What is a Foreign key?
Answer: Foreign Key is a set of attributes in a table which is used to refer the primary key or alternative key of the same or other tables.

Question 6: Difference between Inner Join and Outer Join.
Answer: An SQL Join is used to combine data from two or more tables, based on a common field between them. Inner Join vs Outer Join.

Sr. No.KeyInner joinOuter join
1Basic It can be used to retrieve only matched records between both tables It is used to retrieve all matching records as well non matching records of the tables  
2Return It doesn’t return anything when match is not found.It return null in the column values 
3Performance It is faster than outer join.It is slower than inner join because of the larger result set
Difference between Inner Join and Outer Join.

Question 8: Explain ACID properties.
Answer: ACID stands for Atomicity, Consistency, Isolation, and Durability. In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties.
Question 9: What is Deadlock in DBMS?
Answer: In a database, a deadlock is an unwanted situation in which two or more transactions are waiting indefinitely for one another to give up locks. Deadlock is said to be one of the most feared complications in DBMS as it brings the whole system to a Halt.
Question 10: What is a Nested Query in SQL? Give an example.
Answer: In nested queries, a query is written inside a query. The result of inner query is used in execution of outer query. Example of nested query in SQL

FROM students
FROM students);

Questions Related to Data Structures

Question 1: What is a Data Structure?
Answer: A data structure is a particular way of organizing data in a computer so that it can be used effectively.
Question 2: What is the difference between a Stack and a Queue?
Stack: A stack is a linear data structure in which elements can be inserted and deleted only from one side of the list, called the top. A stack follows the LIFO (Last In First Out) principle, i.e., the element inserted at the last is the first element to come out.
Queue: A queue is a linear data structure in which elements can be inserted only from one side of the list called rear, and the elements can be deleted only from the other side called the front. The queue data structure follows the FIFO (First In First Out) principle, i.e. the element inserted at first in the list, is the first element to be removed from the list.
To learn more, visit Stack vs. Queue.
Question 3: What is the difference between a Clustered index and non-clustered index?
Answer: A clustered index is a special type of index that reorders the way records in the table are physically stored whereas a non clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.
Question 4: Differentiate between an Array and a Linked List.
Answer: Both Arrays and Linked List can be used to store linear data of similar types, but they both have some advantages and disadvantages over each other. Key difference between array and linked list.
Question 5: What is a Doubly Linked List?
Answer: A Doubly Linked List (DLL) contains an extra pointer, typically called previous pointer, together with next pointer and data which are there in singly linked list.
Question 6: What is a Binary Search Tree?
Answer: Binary Search Tree, is a node-based binary tree data structure which has the following properties:

  • The left subtree of a node contains only nodes with keys lesser than the node’s key.
  • The right subtree of a node contains only nodes with keys greater than the node’s key.
  • The left and right subtree each must also be a binary search tree.
  • There must be no duplicate nodes.

Question 7: What are the advantages of BST over Hash Table?
Answer: The time complexity of Search, Insert and Delete operations in a self-balancing Binary Search Tree (BST) (like Red-Black Tree, AVL Tree, Splay Tree, etc) is O(Logn) whereas Hash Table supports these operations in O(1) time.
Advantages of Hash Table over BST.
Question 8: If you are given two traversal sequences, can you construct the binary tree?
Answer: It depends on what traversals are given. If one of the traversal methods is Inorder then the tree can be constructed, otherwise not.
Question 9: Which data structures are used for BFS and DFS of a graph?

  • Queue is used for BFS
  • Stack is used for DFS. DFS can also be implemented using recursion (Note that recursion also uses function call stack).

Question 10: What does the following function do for a given Linked List with the first node as head?

void fun1(struct node* head)
  if(head == NULL)
  printf("%d  ", head->data);

Answer: It prints all nodes of linked list in reverse order.

Managerial Round

This round includes everything which was in Technical round plus it will be under pressure and a lot of cross-checking. Doubts will be raised on your answers to check if you can handle stress or not. Students may or may not be sent to this round depending on the feedback of the previous round. If the feedback of the previous round was good you may expect to directly been sent to HR round. Key for this round is to be calm, confident, clear on your thoughts and to not give up on the pressure. If you don’t know the answer you must try to attempt it with whatever you know.

HR Round

This is the final round of the recruitment process. The interview panel can question you anything related to your personality, family, education, hobbies, internships, general knowledge, etc.
The key here is to be confident about everything you speak.

 Questions Related to HR Round

Question 1: Tell me something about yourself.
Answer: This is the very first question and will be surely asked in every interview rounds. The best way of answering this question is to tell the interviewer about your interests, skill sets, qualifications, achievements, etc. Try to avoid telling things that are already mentioned in your resume and also make sure not to sound like you have mugged this answer.

Question 2: What are your strengths and weaknesses?
Answer: This is one of the most commonly asked questions in an HR interview. Be honest while answering this question. Do not hesitate to mention your strengths but try to keep the count to 3-4 only by picking up the main strength that will help you in this job. While mentioning weaknesses, try to present it as a strength or get prepared for the answer to “How do you prepare to overcome this weakness?”.

Question 3: Why should you be hired?
Answer: The best way to answer this question is to present your skills to the interviewer and how are you planning to use it for the growth of the company.

Question 4: How will you manage work pressure?
Answer: Try to answer this question by giving examples of your previous experiences. Tell him/her about a situation in your life so far where you have been under pressure and still you managed to complete the task within the deadline.

Question 5: Why do you want to join us?
Answer: This question will reflect the amount of research you have done about the company. You can mention the achievements of the company, work culture, behavior with employees, work-life balance and other positive things about the company.

Question 6: What is your salary expectation?
Answer: This can be a tricky question. If you are a fresher, never ever quote the exact amount that you want in your offer letter. You may ask him/her about the hike that the company generally offers to the employees but do not quote the amount.

Question 7: Are you comfortable with rotational shifts?
Answer: This is the most commonly asked question in the interviews of IT companies like TCS, CTS, Wipro, Infosys, etc. Answering this question with a “Yes” will surely increase your chances of getting the job but it is recommended to say Yes only if you are actually comfortable with rotational shifts.

Question 8: Why are you looking for a Job change?
Answer: This is a common question if you are an experienced professional and looking for a change. The best way to answer this question is to say that, You are changing your current job for growth. Make sure that you not talk negatively about or criticize the company you are currently working in.

Final word

You will find loads of overwhelming information on the internet. Different candidates have different experiences and they share it on the net. But the key is to be well-prepared with what you have written in your resume and to accept if you do not know any of the answers. There is no shortcut to clearing TCS interview. If you don’t know one answer, don’t get nervous or confused, the interviewers judge you on overall performance and not just one or two questions. Be honest, be confident and most importantly, be cool, so that you can remember the answers you have prepared.

You may also like

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.