Top 70+ TCS Interview Questions and Answers You Should Check in 2024

Posted in

Top 70+ TCS Interview Questions and Answers You Should Check in 2024
sameekshamedewar

Sameeksha Medewar
Last updated on November 22, 2024

    Tata Consultancy Services (TCS) is an Indian multinational information technology (IT) services and consulting company. It has its headquarters in Mumbai, Maharashtra, India. The largest campus of TCS is located in Chennai, Tamil Nadu, India.

    TCS is a subsidiary of the Tata Group and it operates in 149 locations across 46 countries, including the United States, Mexico, Canada, South Africa, Morocco, Indonesia, Japan, Hong Kong, and Singapore.

    In 2015, TCS was ranked 64th in the Forbes list of the World’s Most Innovative Companies. Also, in 2018, the company became the first Indian IT company to reach $100 billion in market capitalization.

    Since TCS is a well-known and renowned company, people consider it a brand that can help them advance their careers. It is one of the best companies to start your career in the IT domain. Also, this company provides a pleasant working environment for its workers.

    If you aim to start your IT career with TCS, you can register for its mass recruitment process. The company conducts the recruitment process every year to hire freshers for the Assistant System Engineer role.

    Through this article, you will get introduced to the mass recruitment process of TCS and the frequently asked TCS interview questions, along with their detailed answers. So, let us get started!

    TCS Recruitment Process

    Let us discuss the eligibility criteria and the TCS recruitment process in detail below.

    Eligibility Criteria

    The eligibility criteria to appear for the TCS recruitment drive are given below:

    Category Requirement
    SSC Marks Above 60%
    HSC Marks Above 60%
    Degree B.Tech/M.Tech or BE/ME
    CGPA Greater than 6 CGPA
    Year Gap Maximum 2 years.

    Recruitment Process

    The TCS recruitment process involves four rounds, namely the written round, technical round, managerial round, and HR round. The company selects freshers for the Assistant System Engineer role through its recruitment drive. Let us briefly discuss each of the rounds in the TCS recruitment process below.

    1. Written Round

    The first round of the TCS recruitment process is called TCS NQT (National Qualifier Test). This round consists of four sections, namely quantitative aptitude test, programming language test, coding round, and email writing. The total time allocated for this round is 90 minutes.

    • Quantitative Aptitude Test: This section validates candidates’ reasoning ability. It includes 20 multiple-choice questions, and there is a negative marking of? for every wrong answer. The time allotted for this section is 40 minutes. Questions from this section are based on topics, including percentages, ratio and proportion, averages, permutation and combination, time, speed, and distance, and number and alphabet series.
    • Programming Language Test: This section contains 10 to 12 multiple-choice questions from computer science and programming languages. The time allotted for this section is 20 minutes.
    • Coding Round: This section consists of 1 or 2 coding questions, and the time allotted is 20 minutes.
    • E-mail Writing: This section involves e-mail writing based on the given phrases or words. The time allotted to write an e-mail is 10 minutes. You have to make sure that you use all the given words or phrases in your e-mail.

    2. Technical Round

    The technical round is the second round of the TCS recruitment process that validates an individual’s technical knowledge. This round contains questions related to various programming languages, object-oriented programming , data structures and algorithms, DBMS, networking, and operating systems. Also, there is a possibility that you may be asked to write code.

    3. Managerial Round

    Candidates who clear the technical round have to appear for the managerial round. This round is the same as the technical round, but you may also have to face managerial questions. Most of the questions are associated with the profile for which you are being interviewed, i.e., Assistant System Engineer.

    Moreover, an interviewer may give you certain scenarios and ask how you will behave or react to them. The motive is simply to assess your thinking process. You may also be questioned based on your achievements and experiences listed in the resume. In a nutshell, this round assesses your soft skills, attitude, corporate culture fit, and thinking process.

    4. HR Round

    The HR round is the last round of the TCS recruitment process. The panel of recruiters questions you related to your education, family, goals, ambitions, hobbies, salary expectations, etc. The key to clearing this round is to answer the questions confidently.

    Top TCS Interview Questions and Answers

    Here is the curated list of commonly asked TCS interview questions, along with their appropriate answers. We have divided this list into various categories so that you can easily search for questions from a specific category.

    Common TCS Interview Questions on C/C++

    1. Can you explain how C and C++ are different from each other?

    We can say that C is the subset of C++. The following table shows how C and C++ differ from each other:

    C C++
    It is a procedural and functional-driven language. It is an object-oriented language.
    Since C is a procedural language, it does not support polymorphism, encapsulation, and inheritance. Since C++ is an object-oriented language, it supports polymorphism, inheritance, and encapsulation.
    Data and functions in C are separated. Data and functions in C++ are encapsulated.
    This language does not support function and operator overloading. This language supports function and operator overloading.
    C follows the top-down approach. C++ follows the bottom-up approach.
    It uses scanf to accept user input and printf to display output. It uses cin to take user input and cout to display output.
    C programs are divided into procedures and modules. C++ programs are divided into classes and functions.

    2. What do you know about the term ‘macro’?

    A macro is a piece of code in a program that has a specific name. Whenever a compiler comes across this name, it replaces the name with the actual piece of code. We define macros using the #define directive. Let us look at a C program to understand how macros work.

    #include<stdio.h>
    
    #define RADIUS 5
    
    void main()
    
    {
    
    printf("The radius of a circle is:%d", RADIUS);
    
    }

    Output:

    The radius of a circle is: 5.

    3. What do you know about a static variable?

    A static variable is a variable that preserves its value even after it is out of scope. Static variables preserve their values in the previous scope, and we cannot initialize them again in the new scope. They are initialized only once, and the default value of a static variable is 0.

    Syntax:

    static datatype variable_name = value;

    A static variable remains in the memory throughout the program, whereas an auto or normal variable gets destroyed when the function call where we declare that variable is over.

    Example of a static variable:

    #include<stdio.h>
    
    int display
    
    {
    
    static int count = 0;
    
    count++;
    
    return count;
    
    }
    
    void main()
    
    {
    
    printf("%d \n", display());
    
    printf("%d", display());
    
    }

    Output:

    1
    
    2

    Example of an auto or normal variable:

    #include<stdio.h>
    
    int display
    
    {
    
    int count = 0;
    
    count++;
    
    return count;
    
    }
    
    void main()
    
    {
    
    printf("%d \n", display());
    
    printf("%d", display());
    
    }

    Output:

    1
    
    1

    4. What are the four storage classes in C?

    Storage classes in C define the features of variables or functions. These features include visibility, scope, and lifetime. They help us track the existence of a variable during the runtime of a program. There are four storage classes in C, as listed below:

    • auto: This storage class is the default one for all the variables declared inside a function or block.
    • extern: This storage class tells that a variable is defined somewhere else and not within a function or a block where it is used.
    • static: We can define static variables in our C programs using this storage class.
    • register: We can define register variables using this storage class. Register variables are analogous to auto or normal variables.

    5. Can you explain ‘pass by value’ and ‘pass by reference’?

    In C, ‘pass by value’ and ‘pass by reference’ are two different ways to pass parameters to a function.

    Pass by Value: Pass by value means we pass the copy of actual variables as parameters to a function. So, any changes made in the function do not affect the original value of variables.

    Pass by Reference: Pass by reference means we pass the address of actual variables as parameters to a function. Any changes made inside the function can change the value of the original variables.

    6. What do you know about structures in C?

    A structure in C or C++ is a user-defined function. It creates a data type that combines items of different data types into a single type. We use the struct keyword to define a structure.

    Syntax:

    struct structureName
    
    {
    dataType member1;
    dataType member2;
    ...
    };

    The following is the structure for an employee that contains employee name, employee ID, and salary:

    struct Employee
    {
    char name[50];
    int citNo;
    float salary;
    };

    7. Can you explain pointers?

    A pointer in C is a variable that stores the address of a variable rather than its value. Alternatively, we can think of a pointer as a variable that stores the address of another variable.

    Syntax:

    int* a;
    
    int* b;

    Here, we have declared pointers ‘a’ and ‘b’ of type int. Another way of declaring the above two pointers is as follows:

    int* a, b;

    Example:

    #include<stdio.h>
    
    void main()
    
    {
    
    int* p, q;
    
    q = 350;
    
    p = &q;
    
    printf("%d", *p);
    
    }

    Output:

    350

    Common TCS Interview Questions on OOPS

    8. What are the different concepts of object-oriented programming?

    There are four major concepts in OOPS that are discussed as follows:

    • Encapsulation: Encapsulation involves the process of binding data and code together into a single unit. We can think of encapsulation as a protective shield where any code from outside cannot access the data present in it.
    • Abstraction: Abstraction or data abstraction is the property by which only the essential details are displayed to users. In other words, data abstraction is the process of identifying only the essential characteristics of an object and ignoring the non-essential details.
    • Polymorphism: Polymorphism means performing one task in different forms. In technical terms, polymorphism means differentiating between different entities with the same name.
    • Inheritance: Inheritance is the process where one class inherits or extends the properties of another class.

    9. What do you understand about ‘classes’ and ‘objects’?

    Class: A class is a user-defined blueprint or prototype from which objects are created. It represents variables and methods that are common to all objects of one type. It determines how an object will behave and what it will contain. We declare a class using the class keyword.

    Syntax:

    class class_name
    
    {
    
    field;
    
    method;
    
    }

    Object: An object is a real-world entity that has some characteristics and behaviour defined by its class. In short, an object is an instance of a class. When we define a class, no memory is allocated to it. But when we create an object of that class, i.e., when we instantiate the class, memory is allocated.

    For example, let us consider a dog as an object. The properties of a dog would be age and colour, whereas behaviour would be bark, sleep, and eat.

    10. What is function overloading?

    Function overloading is an important feature of object-oriented programming where two or more functions have the same name but have different function signatures, i.e., different number of parameters and different data types of that parameters. Alternatively, function overloading means a single function overloaded with multiple jobs.

    Example:

    #include<iostream>
    
    using namespace std;
    
    int sum(int a, int b)
    
    {
    
    return a+b;
    
    }
    
    int sum (int p, int q, int r)
    
    {
    
    return p+q+r;
    
    }
    
    int main()
    
    {
    
    cout<<"Addition of two numbers: "<<sum(10, 20)<<endl;
    
    cout<<"Addition of three numbers: "<<sum(30, 50, 70)<<endl;
    
    return 0;
    
    }

    Output:

    Addition of two numbers: 30
    
    Addition of three numbers: 150

    11. What is function overriding?

    When the derived class defines the same member function with the same name and same function signatures, i.e., the same number of parameters and same data types of that parameters, as defined in its base class, it is called function overriding. If we use an object of the derived class to call this overridden function, the function from the derived class is invoked.

    Example:

    #include<iostream>
    
    using namespace std;//base class
    
    class shape
    
    {
    
    public:
    
    void triangle()
    
    {
    
    cout<<"It is a triangle.";
    
    }
    
    };
    
    //derived class
    class shape1: public shape
    {
    public:
    void triangle()
    {
    cout<<"It has three sides.";
    }
    };
    int main()
    {
    shape1 s1 = shape1(); //object of derived class
    s1.triangle();
    return 0;
    }

    Output:

    It has three sides.

    12. Can you differentiate between function overloading and function overriding?

    The following table draws the key differences between function overloading and function overriding:

    Function Overloading Function Overriding
    When two or more functions have the same name with different function signatures, it is called function overloading. When the derived class defines the function with the same name and return type as defined in its base class, it is called function overriding.
    It is a compile-time polymorphism. It is a run-time polymorphism.
    We can overload a single function multiple times. We can override a single function only once.
    Overloaded functions are in the same scope. Overridden functions are in different scopes.

    13. Explain different types of inheritance.

    We define inheritance as the ability of a class to inherit properties or characteristics from another class. The class that inherits properties from the other class is the derived or child class. On the other hand, the class from which other classes inherit properties is the base or parent class. The following are the different types of inheritance:

    • Single Inheritance

    In single inheritance, a class inherits properties from a single class, i.e., there is only one base class and one child class.

    • Multiple Inheritance

    In multiple inheritances, a class inherits properties from more than one class, i.e., there is only one derived class and multiple base classes.

    • Multilevel Inheritance

    In multilevel inheritance, a class inherits properties from another derived class. In other words, a class inherits the properties from the other class, which is a derived class of another class.

    • Hierarchical Inheritance

    Hierarchical inheritance is opposite to multiple inheritances. In hierarchical inheritance, multiple classes can inherit properties from a single class, i.e., a single base class can have multiple subclasses.

    • Hybrid Inheritance

    Hybrid inheritance combines more than one type of inheritance. For example, the combination of hierarchical and multiple inheritances is a hybrid inheritance.

    14. What do you know about access modifiers?

    Data hiding is one of the most significant features of object-oriented programming, which is implemented using access modifiers. Access modifiers are used to set the accessibility or scope of the field, class, methods, or constructors. When we use access modifiers on class members, any function outside that class cannot access them.

    Object-oriented programming languages use three types of access modifiers, namely public, protected, and private. Let us discuss each of these access modifiers below.

    • Public: When we declare class members public, they are available to everyone. Functions from other classes can access data members and data functions declared as public.
    • Private: When we declare class members private, only the member functions of that class can access them. Class members that are declared private cannot be accessed directly by an outside function or object. Only the member functions or friend functions can access the private data of members of a class.
    • Protected: Like the private access modifier, when we declare class members protected, we cannot access them outside the class. However, they can be accessed by any subclass of that class.

    15. State the difference between a structure and a class

    Here are the key differences between a structure and a class:

    Structure Class
    A structure is a function that creates a data type combining multiple variables of different data types under one name in a block of memory. A class is a blueprint or prototype from which objects are created. It is a collection of variables and functions.
    The members of a structure are public by default. The members of a class are private by default.
    An instance of structure is called the ‘Structure variable’. An instance of a class is called an ‘object’.
    A structure does not support inheritance. A class supports inheritance.
    Memory allocation happens on a stack. Memory allocation happens on a heap.
    A member of a structure cannot be NULL. A class variable may have a NULL value.
    We declare a structure using the ‘struct’ keyword. We declare a class using the ‘class’ keyword.

    16. Explain friend class and friend function.

    Friend Class: A friend class can access the private and protected members of other classes in which it is declared as a friend. We use the ‘friend’ keyword to declare a class as a friend class.

    Friend Function: Like friend class, a friend function can also access private and protected members of a class. A friend function can be a member function of another class or a global function. We use the ‘friend’ keyword to declare a function as a friend function.

    17. How is memory allocation done in C++?

    In C++, memory allocation is done using the new operator. This operator requests for memory allocation on the Free Store. If sufficient memory is available, the new operator initializes the memory and returns the address of the newly initialized memory to the pointer variable.

    Syntax:

    pointer-variable = new data-type;

    18. Explain pure virtual function.

    A pure virtual function is a function for which we do not have to write any function definition, and we only need to declare it. We declare a function as a pure virtual function by assigning a 0 to it, as shown below:

    Syntax:

    class class_name
    
    {
    
    public:
    
    // Pure Virtual Function
    
    virtual void function_name() = 0;
    
    };

    19. Why is the size of an empty class not zero in C++?

    The size of an empty class in C++ is not zero. Instead, it is 1 byte. We know that memory is allocated to a class when the objects are created. So, the compiler allocates 1 byte to an object of an empty class for its unique address identification. Or we can say that an empty class is non-zero to ensure that two different objects have different addresses.

    TCS Java Interview Questions

    20. Can you tell how Java is platform-independent?

    In many programming languages, such as C, we need to compile code every time we execute it on a different platform or operating system. However, it is not the case with Java. The Java Virtual Machine (JVM) compiles Java code into bytecode, and that bytecode can run on all Java-enabled platforms. This feature of Java is called ‘Write Once Run Anywhere (WORA)’.

    21. Explain the difference between a class and an interface.

    The following table highlights the differences between a class and an interface:

    Class Interface
    A class is a blueprint or template from which objects are created. It is a collection of variables and functions. An interface also contains variables and functions, but functions in it are abstract, i.e., functions in an interface only have signatures and nobody.
    We can create objects of a class, i.e., we can instantiate a class. We cannot create objects of an interface, i.e., we cannot instantiate an interface.
    A class does not support multiple inheritances. An interface supports multiple inheritances.
    We declare a class using the ‘class’ keyword. We declare an interface using the ‘interface’ keyword.
    Class members can be declared as public, private, or protected. All variables and methods of an interface are public.

    22. Tell something about JVM and JRE.

    JVM: JVM stands for Java Virtual Machine. It acts as a run-time engine to run Java applications. In other words, JVM is a virtual machine that allows computer systems to run Java programs and programs written in other languages that are compiled to Java bytecode.

    JRE: JRE stands for Java Runtime Environment. It is a part of a Java Development Kit (JDK). JRE is a software layer that runs on top of a computer’s operating system and provides class libraries and resources required to run Java programs. It is a runtime implementation of JVM.

    23. What is Java not purely object-oriented?

    Java is not purely object-oriented because it supports primitive data types, like int, byte, long, etc., which are not objects. For any programming language to be purely object-oriented, it must have the following features:

    • Abstraction
    • Polymorphism
    • Encapsulation
    • Inheritance
    • All predefined and user-defined types are objects.
    • All operations performed on objects must be through methods exposed to that object.

    24. Can you explain the NullPointerException in Java?

    NullPointerException is a runtime exception in Java. Also, Java allows us to assign a NULL value to an object reference. NullPointerException is thrown when a program uses an object reference that has a NULL value.

    25. Is the main method compulsory in Java?

    The main method in a Java program was not mandatory before JDK7. But from JDK7, it is mandatory to write the main method in a Java program. If your Java program does not have the main method, the compiler displays an error message - “the main method not found in the class”.

    26. Can you tell the output of the following Java program?

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

    Output:

    60 40 16

    27. Will the following code compile?

    import java.util.*;
    
    public class Test {
    
    public static void main(String[] args)
    
    {
    
    byte a = 10;
    
    byte b = 12;
    
    byte result = a + b;
    
    System.out.print(result);
    
    }
    
    }

    No, the above code will not compile. The result ‘a+b’ has to be typecasted to byte. To make the above code run, we need to replace the line of code ‘byte result = a+b;’ to

    int result = a + b;

    Then the output will be 22.

    28. What will be the output of the following code?

    import java.util.*;
    
    public class Test {
    public static void main(String[] args)
    {
    System.out.print("Hello");
    System.out.println("World");
    }
    }

    The output of the above code will be:

    HelloWorld

    29. What changes should you make in the above code to print Hello and World in two different lines?

    We need to use

    System.out.println("Hello");

    instead of

    System.out.print("Hello");

    Common TCS Interview Questions on DBMS

    30. What is a database, and what do you know about DBMS?

    Database: A database is a collection of data stored electronically in a computer system and organized system so that it becomes easier to access and manage. We can insert, delete, and update data stored in a database.

    DBMS: DBMS stands for the database management system. It is the software responsible for managing a database, and it allows us to create as many databases as we wish. This software provides data from databases when requested by users and other applications. DBMS makes it possible for us to insert, delete, and update data stored in a database.

    31. What do you know about the term ‘database schema’?

    A database schema is a structure or an abstract design that represents the logical view of a database. It represents how data in a database is organized and the relation between different tables of a database. A database schema does not store data physically. Instead, it provides information about the data storage in a database.

    32. Explain the primary key and foreign key.

    Primary Key: A primary key is a column of a table, which ensures that data in it is unique and not redundant. This column cannot contain NULL or duplicate values.

    Foreign Key: A foreign key is a column or a group of columns that provides a link between two database tables. Alternatively, it is a column or a set of columns of one table that refers to the primary key of another table.

    33. Can you explain SQL joins?

    A SQL join is a clause used to combine tuples from two or more tables based on the related column between those tables. There are four types of SQL joins that are as follows:

    • INNER JOIN: The INNER JOIN returns records having matching values in both tables.
    • LEFT OUTER JOIN: The LEFT OUTER JOIN returns all records from the left table and matching records from the right table.
    • RIGHT OUTER JOIN: The RIGHT OUTER JOIN returns all records from the right table and matching records from the left table.
    • FULL OUTER JOIN: The FULL OUTER JOIN returns whenever there is a match either in the left or right table.

    34. Explain ACID properties.

    ACID stands for Atomicity, Consistency, Isolation, and Durability. Let us discuss each of these properties below:

    • Atomicity: Atomicity ensures that a transaction either takes place at once or does not happen at all, i.e., transactions do not occur partially. There are two operations related to transactions, namely, abort and commit. The changes made to the database are not visible if a transaction aborts. On the other hand, a transaction commits if the changes made to the database are visible.
    • Consistency: Consistency implies that a database should be consistent before and after a transaction occurs, i.e., it ensures the correctness of a database.
    • Isolation: Isolation ensures that multiple transactions run simultaneously without leaving the database inconsistent. Also, each transaction occurs independently without the intervention of the other, i.e., each transaction occurs in isolation.
    • Durability: Durability ensures that all the changes and modifications made to a database after the execution of a transaction are written to the disk or stored in non-volatile memory, and they persist even if the system fails.

    35. What is a nested query in SQL?

    A SQL query within another SQL query is called a nested query. We can also refer to a nested query as an inner query or subquery. The outer query utilizes the result of its subquery.

    Syntax:

    SELECT column_name
    
    FROM table
    
    WHERE condition
    
    (SELECT column_name
    
    FROM table
    
    [WHERE condition])

    36. Can you explain the deadlock in DBMS?

    A deadlock in the database management system is a situation where two transactions indefinitely wait for each other to give up their locks. It is considered one of the most complicated and feared situations in DBMS since it brings an entire system to a halt. To understand the deadlock, let us take one example.

    Consider two tables, Employees and Details, and two transactions, T1 and T2. Suppose T1 holds a lock on some rows of the Employees table and needs to update some rows in the Details table.

    At the same time, T2 holds a lock on some rows, which T1 needs to update, of the Details table. It also needs to update some rows in the Employees table, which have locks held by T1. In such a situation, a deadlock occurs. T1 waits for T2 to give up the lock on the Details table, while T2 waits for T1 to give up the lock on the Employees table.

    As a result, the entire system comes to a halt and continues to remain halt until the database detects a deadlock and aborts one of the two transactions.

    37. What is mutual exclusion?

    Mutual exclusion is a concurrency control property to prevent deadlock in a database. It prevents access to a resource by multiple processes at the same time.

    38. Tell something about bubble sort, merge sort, and insertion sort.

    Bubble Sort: Bubble sort is the simplest, comparison-based sorting algorithm in which two adjacent elements are compared and are swapped if not in order. This algorithm is not ideal for sorting large sets of data since its worst and average-case complexity is O(n2), where n is the number of elements.

    Merge Sort: Merge sort is one of the most efficient algorithms to sort elements since it uses the Divide and Conquer approach. Firstly, it divides the list of elements into two halves. Later, it calls itself for two halves of the list and then merges the two sorted halves. The merge() function is used to merge two halves. The complexity of the merge sort algorithm is O(n*Log n) in the worst, average, and best cases.

    Insertion Sort: Insertion sort is the simple sorting algorithm in which higher-ranked elements in a list are transferred to the right position one at a time to sort the list.

    39. What is a data structure?

    A data structure is a specific and systemic way of organizing data in a computer system so that we can retrieve and manage it efficiently. Some popular data structures include array, linked list, tree, graph, queue, stack, and structure.

    40. Can you state the difference between a stack and a queue?

    The following table highlights the differences between a stack and a queue:

    Stack Queue
    Stacks follow the LIFO (Last In First Out) principle, i.e., the last element inserted is the first to come out of a list. Queue follows the FIFO (First In First Out) principle, i.e., the first element inserted is the first to come out of a list.
    Insertion and deletion of elements in a stack take place only from the top of the list. Insertion of elements takes place at the rear of the list and deletion at the front of the list.
    The insert operation in a stack is called a push, and the delete operation is called pop . The insert operation in a queue is called enqueue, and the delete operation is called dequeue .
    A stack has only one pointer that always points to the last element in the list. A queue has two pointers, namely the front pointer and the rear pointer. The front pointer points to the first element in the list and the rear pointer points to the last element.

    41. Differentiate clustered and non-clustered indexes.

    The following table draws key differences between clustered and non-clustered indexes:

    Clustered Index Non-Clustered Index
    A clustered index is created only when the data or file that you are moving into secondary memory is in sequential or sorted order and that data or file cannot have redundant values. A non-clustered index is analogous to the index of a book. It consists of the chapter name and page number. You can directly go to the desired chapter to read by looking at its page number, without going through every page of the book.
    This type of index requires less memory for operations and is faster. This type of index consumes more memory for operations and is comparatively slower.
    In a clustered index, the index is the main data. In a non-clustered index, the index is the copy of actual data.
    A table can have only one clustered index. A table can have multiple non-clustered indexes.

    42. What is the difference between an array and a linked list?

    Here are the significant differences between an array and a linked list:

    Array Linked List
    An array is the collection of items of similar data types. A linked list is a linear collection of nodes, where each node consists of data and an address of the next node.
    In an array, elements are stored in a contiguous memory location. In a linked list, elements are stored randomly.
    Elements in an array are independent of each other. Elements in a linked list are dependent on each other since the address of a node is held by its previous node.
    Memory allocation takes place at compile-time, i.e., static memory allocation. Memory allocation takes place at runtime, i.e., dynamic memory allocation.
    Insertion and deletion operations in an array consume a lot of time. Insertion and deletion operations in a linked list are easy and fast.

    43. What do you understand about the doubly linked list?

    A doubly linked list is a linear collection of linked records called nodes. Each node has three fields - one data field and two link fields; one pointed to the previous node and the other to the next node in the sequential list of nodes.

    44. Can you explain the binary search tree?

    The binary search tree is a node-based tree data structure having the following properties:

    • The left subtree of a node should contain nodes with keys lesser than the node’s keys.
    • The right subtree of a node should contain nodes with keys greater than the node’s keys.
    • The right and left subtree should be a binary search tree.

    45. What data structures are used to implement breadth-first search and depth-first search?

    We use a queue to implement breadth-first search and a stack for depth-first search. You can find the Python code for breadth-first search here . Also, get access to the Python code for depth-first search here .

    TCS Coding Interview Questions

    46. Print first n Fibonacci series.

    Get access to the Python code for printing the first n Fibonacci series here .

    47. Reverse a linked list.

    You can access the detailed code for reversing a linked list here .

    48. Implement the Binary Search Tree.

    Get the complete Python code for implementing the Binary Search Tree here .

    49. Find duplicates in an array.

    Get access to the Java, Python, and C++ code for finding duplicates in an array here .

    50. Merge two sorted arrays.

    You can review the C++ and C code for merging two sorted arrays here .

    TCS Aptitude Interview Questions

    51. If the alphabet are written in the sequence of a, bb, ccc, dddd, eeeee, ffffff, …. What will be the 120th letter?

    O

    Explanation: We can see that the given sequence of letters is in Arithmetic Progression. Therefore, by using the formula of A.P., we get,

    [n(n+1)]/2 <= 120

    We find that n =15 fits the above equation.

    The 15 th letter in the alphabet is O.

    Therefore, the 120th letter will be O.

    52. Find the number of perfect squares in the given series 2013, 2020, 2027, ……………., 2300? (Hint 44^2=1936).

    1.

    Explanation: The given series in AP with the common difference of 7.

    Therefore, the series is in the form of 2013 + 7d.

    We are provided with a hint 44^2=1936.

    452 = 2025

    462 = 2116

    472 = 2209

    482 = 2304

    From the above number, we need to find which numbers are in the form of 2013 + 7d.

    We can observe that only one number, i.e., 2099 can be written in the form of 2013 + 7d, i.e., 2013 + (7*28).

    Therefore, the answer is 1.

    53. There is a tank whose 1/7 th part is filled with fuel. If 22 liters of fuel is poured into the tank, the indicator rises to 1/5 th mark of the tank. So what is the total capacity of the tank?

    385 liters.

    Explanation: Let the total capacity of the tank be ‘x’ liters. As per the given condition in the question, we get the following equation

    x/7 + 22 = x/5 x/5 – x/7 = 22 x = 385.

    Therefore, the total capacity of the tank is 385 liters.

    54. In the sequence of problemsolvingproblemsolvingproblemsolving… what is the 2015th alphabet?

    n.

    Explanation: There are 14 letters in ‘problemsolving’ and we need to find the 2015th alphabet. On dividing 2015 by 14, we get 13, and the 13th letter is n. Hence, the answer is n.

    55. In a class, the number of boys is equal to the number of girls. What will be the total number of students if twice the number of boys as girls remained when 12 girls entered out?

    48.

    Explanation: Let the number of girls be ‘g’ and the number of boys is ‘b’.

    According to the given condition,

    b / (g – 12) = 2 / 1

    Since b = g, we get, g = 24.

    Therefore, the total number of students = b + g = 24 + 24 = 48.

    56. Tom takes 3 days to complete work while John takes 2 days. Both of them finish work and earn Rs. 150. What is Tom’s share of the money?

    Rs. 60.

    Explanation: Tom completes 1/3rd of work in one day while John completes ½ work in one day. So, the ratio of their work is (1/3):(½) = 2:3.

    Therefore, Tom’s share is (2/5)*150 = Rs. 60.

    57. Sam and Harry’s salaries are in the ratio of 2:3. If both of their salaries are increased by Rs 4000 each, the new ratio becomes 40:57. What is Harry’s present salary?

    Rs. 34,000.

    Explanation: Let Sam and Harry’s salaries be x.

    Then the ratio of their salaries will be 2x:3x.

    According to the given condition in the question,

    (2x+4000):(3x+4000) = 40:57. i.e., 57(2x+4000) = 40(3x+4000).

    114x + 228,000 = 120x + 160,000.

    120x - 114x = 228,000 - 160,000.

    6x = 68,000.

    3x = 34,0000.

    Therefore, Harry’s present salary is Rs. 34,000.

    58. At what rate percent per annum will the SI on a sum of money be 2/5 of the amount in 10 years?

    4%.

    Explanation: Let the sum of money be ‘x’. So, Simple Interest (SI) = 2x/5. Therefore, r = SI*100)/(P*Time)

    r = (2x*100)/(5*x*10) = 200/50.

    r = 4%.

    59. Identify the missing number in the series: 2, 5, __, 19, 37, 75.

    9.

    Explanation:

    2 * 2 + 1 = 5.

    5 * 2 – 1 = 9.

    9 * 2 + 1 = 19.

    19 * 2 – 1 = 37.

    37 * 2 +1 = 75.

    60. In the given series: 70, 54, 45, 41……. What will be the next number?

    40.

    Explanation:

    70 – 54 = 16 (42).

    54 – 45 = 9 (32).

    45 – 41 = 4 (22).

    41 – 40 = 1 (11).

    TCS HR Interview Questions

    The HR round is the final round of the TCS recruitment process. You may expect the following questions in this round:

    61. Tell me about yourself.

    62. What are your hobbies?

    63. What are your strengths and weaknesses?

    64. Why should we hire you?

    65. What is your strategy for managing work under pressure?

    66. Why do you want to join our company?

    67. What are your short-term and long-term goals?

    68. Are you comfortable with rotational shifts?

    69. Will you be comfortable relocating?

    70. Tell me about yourself that makes you stand out from your counterparts.

    71. What do you think are the qualities that one must possess for this profile?

    Conclusion

    TCS is a great place to kick-start your career in the IT domain. If you are a freshly graduated candidate, you can register for the TCS recruitment drive since the company conducts this drive every year for the role of Assistant System Engineer.

    To nail the TCS interview, it is essential to possess self-confidence, a positive attitude, and excellent communication skills. In addition to these, you must have in-depth knowledge of C, C++, Java, object-oriented programming, data structures, and databases. More importantly, you should be able to solve aptitude questions in a short time to qualify for TCS NQT.

    Through this article, we have covered the most frequently asked TCS interview questions related to various programming languages, coding, and HR. You can go through these questions and their answers to increase your chances of cracking your next TCS interview.

    All the best!

    People are also reading:

    FAQs


    There are four rounds in the TCS interview: 1. Written 2. Technical 3. Managerial 4. HR.

    For freshers, TCS offers INR 3 lakhs to 3.6 lakhs per annum.

    Yes, the panel of interviews will definitely ask coding questions so that they can validate our coding skills.

    To appear for the TC interview, you must hold a bachelor's or master's degree with a minimum aggregate of 60%, no more than backlog or ATKT, and no gaps in education.

    You can expect questions on programming languages, databases, data structures & algorithms, computer networks, and operating systems. Check out the above article to know some of the most commonly asked questions in the TCS interview.

    Leave a Comment on this Post

    0 Comments