TCS Interview Questions

TCS is a great place to start your career as a fresher. It offers a great workplace as well as a friendly environment with a positive ambiance for the growth of the individual along with the growth of the company. Every year, TCS conducts a mass recruitment process to select candidates for the profile of Assistant Software Engineer. Apart from the Eligibility Criteria, TCS wants its employees to be very good in Aptitude and in Attitude.

Eligibility Criteria

Category Requirement
Marks in 10th Above 60%
Marks in 12th Above 60%
Age limit 18 to 28 years
Degree BE/ME or B.Tech/M.Tech
CGPA More than 6 CGPA
Experience 0-3 years
Year Gap Maximum 2 years

Note: A candidate with a maximum of 1 backlog can appear for TCS interview, but at the time of joining there must not be any backlogs.

Recruitment Process

TCS conducts 4 rounds to select freshers as Assistant System Engineer in their organization.

Written Round

The Written round consists of four sections and the total time allotted is 90 minutes. The four sections include:



  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 5: What do you mean by ‘pass by value’ and ‘pass by reference’?
Answer: In C we can pass the parameters in a function in two different ways:

More about parameter passing techniques in C/C++.
Practice problem on Parameter passing in C/C++.
 
Question 6: 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 7: 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 8: Write a program to find sum of elements in a given array.
Answer: Program to find sum of elements in a given array
 
Question 9: Write a program to reverse an array or string.
Answer: Program to reverse an array or string.
 
Question 10: Write output of following code:

filter_none

edit
close

play_arrow

link
brightness_4
code

#include <stdio.h> 
int main() 
    int x = 10, *y, **z; 
    
    y = &x; 
    z = &y; 
    printf("%d %d %d", *y, **z, *(*z)); 
    return 0; 
chevron_right

Output:

10 10 10

 
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:

 
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: Function Overloading provides multiple definitions of the function by changing signature i.e changing the number of parameters, change the data type of parameters, return type doesn’t play any role whereas Function Overriding is the redefinition of base class function in its derived class with same signature i.e return type and parameters.
 
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?
Answer:
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 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 8: What is the output of the following program?

filter_none

edit
close

play_arrow

link
brightness_4
code

import java.util.*
    
public class Test { 
public static void main(String[] args) 
    
        int[] x = { 120, 200, 016 }; 
        for (int i = 0; i < x.length; i++
            System.out.print(x[i] + " "); 
    
chevron_right

Output:

120 200 14

 
Question 9: Write a Java Program to Multiply two Matrices of any size.
Answer: Program to Multiply two Matrices of any size
 
Question 10: Write a Java program to Remove first element from ArrayList.
Answer: Program to Remove first element from ArrayList.
 
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.
 
Question 7: Suppose (A, B) and (C, D) are two relation schemas. Let r1 and r2 be the corresponding relation instances. B is a foreign key that refers to C in r2. If data in r1 and r2 satisfy referential integrity constraints, which of the following is ALWAYS TRUE?


Answer: A. See explanation.
 
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. See Example.
 
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?
Answer:
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:

 
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?
Answer:



 
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)
    return;
  
  fun1(head->next);
  printf("%d  ", head->data);
}

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

Tips to get started for Technical Interviews

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.

Tips to prepare for HR Interviews
Sample Interview Experiences :

It is always beneficial if you know what it is to be there at that moment. So, to give you an advantage, we provide you Interview Experiences of candidates who have been in your situation earlier. Make the most of it.

  1. TCS Interview Experience | Set 1 (On -Campus)
  2. TCS Interview Experience | Set 2 (On-campus Recruitment Drive)
  3. TCS Interview Experience | Set 3 (On-campus Recruitment Drive)
  4. TCS DESS Interview Experience | Set 4 (On-campus)
  5. TCS Interview Experience | Set 5 (On-campus)
  6. TCS Interview Experience | Set 6 (On-campus)
  7. TCS Interview Experience | Set 7 (Off-Campus)
  8. TCS Interview Experience | Set 8 (On-Campus)

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.





Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :