TCS Technical Interview Questions and Answers

TCS Technical Interview Questions and Answers 2023

Find the most often asked technical interview questions as well as answers for TCS 2023

The following technical questions were submitted by candidates who were recently hired by TCS.

TCS Technical Interview QuestionsTCS Technical Interview Questions

TCS Online Test Pattern

TCS NQT Placement Papers 2023

Top 20 TCS Technical Interview Questions

Question 1: What are the 4 basic concepts of OOPS?

Answer:

The main concepts of OOPS include:

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

Question 2:- What are the different types of SDLC methodologies?

Answer:

There are 7 different types of SDLC methodologies namely:

  • Lean Methodology
  • Agile Methodology
  • Waterfall Methodology
  • DevOps Methodology
  • Spiral Methodology
  • Iterative Methodology
  • V-model Methodology

Question 3: What is inheritance?

Answer:

Inheritance:

In object-oriented programming, inheritance refers to an object’s ability to acquire one or more properties from other classes of objects.

Questions 4: Write a program to find the sum of elements in a given array using C and C++.

#include 

int calcSum(int arr[], int len){
    int sum = 0;
    
    for(int i = 0; i < len; i++)
        sum = sum + arr[i];
        
    return sum;
}
int main()
{
    int arr[] = {1, 5, 2, 10, 4, 8};
    
    // get the length of the array
    int len = sizeof(arr)/sizeof(arr[0]);    
    
    printf("Sum: %d",calcSum(arr, len));
}
// Time Complexity : O(N)
// Space Complexity : O(N)
#include 
using namespace std;
int main()
{
   int arr[100],i,size,sum=0;
   cout<<"Enter the number of elements: ";
   cin>>size;//Accepting array size
   cout<<"Enter the value of elements: "<>arr[i]; //Accepting values
   }

   for(i=0;i
							

Question 5: What is polymorphism?

Answer:

Polymorphism:

Polymorphism is a fundamental concept in object-oriented programming (OOP) that describes situations in which something appears in multiple forms. It refers to the concept in computer science of being able to access objects of different types through the same interface. Each type can implement this interface independently.

Question 6: Define enumeration in C.

Answer:

Enumeration, also known as Enum in C, is a type of data type that is defined by the user. It is made up of constant integrals or integers that have been given names by the user. The use of enum in C to name the integer values simplifies the entire program’s learning, understanding, and maintenance by the same or a different programmer.

The basic syntax for defining an enum is as follows:

enum enum_name{int_const1,….int_constn}

Question 7: What are the functions of memory allocation in C?

Answer:

Memory allocation functions in C are as follows:

malloc() allocates the requested amount of memory and returns the pointer to the first byte of allocated space.

calloc() Allocates space for array elements. Returns a pointer to the memory after setting the elements to zero.

realloc() is used to increase or decrease the size of previously allocated memory space.

Free() releases or deletes previously allocated memory space.

Question 8: Write a program to reverse an array using JAVA and C++.

import java.util.Scanner;

public class Main
{
   public static void main(String args[])
   {

     int arr[] = {10, 20, 30, 40, 50};

     int n=arr.length;
     for(int i=n-1; i>=0; i--)
       System.out.print(arr[i]+" "); 
    }
}
#include
using namespace std;

int main(){

   int arr[] = {10, 20, 30, 40, 50};
   int n = sizeof(arr)/sizeof(arr[0]);

   for(int i=n-1; i>=0; i--)
      cout<
							

Questions 9:Define encryption.

Answer:

It is the conversion of text into code. Encryption’s primary purpose is to prevent unauthorized access.

Question 10: What is the use of a static variable in C?

Answer

A static variable is used for a common value that is shared by all methods and has a lifetime for the entire program. Static is used with global variables and functions in C programming to limit their scope to the containing file.

A static variable also has the following properties:

  • The static variable retains its value across function calls.
  • Static variables are used because their scope is available throughout the program. As a result, we can access a static variable from anywhere in the program.
  • The static variable is set to zero at the start. When we change the value of a variable, the new value is assigned.
  • To save memory, the static variable is only initialized once in the memory heap.

Question 11: What are the different types of inheritance?

Answer

The different types of inheritance are:

  • Single Inheritance
  • Multi-level inheritance
  • Multiple inheritance
  • Hierarchical Inheritance
  • Hybrid Inheritance

Question 12: Define “pass by value” and “pass by reference”.

Answer:

Pass by value:

A pass-by-value, as the name suggests, is a copy of the value of the actual parameter that is handed in, or more specifically, a copy of the contents of the actual parameter, made in memory.

Pass by reference:

A copy of the address of the real parameter is maintained when using pass by reference. When you are altering a parameter that the client application has passed in, use pass by reference.

Question 13: List different advantages of DBMS.

Answer:

Some common advantages of DBMS include:

  • Improved data security and sharing
  • Integrating data efficiently
  • Trustworthy and consistent data
  • Information that complies with privacy rules
  • Improves productivity
  • Improves decision making 

Question 14: What are the 4 storage classes available in C?

Answer:

The 4 storage classes available in C are:

  • Automatic Storage Class.
  • External Storage Class.
  • Static Storage Class.
  • Register Storage Class.

Question 15: What are the classes and objects?

Answer:

Classes:

The starting point for the creation of objects is a class, which is a user-defined blueprint or prototype. It stands for the collection of traits or procedures that are shared by all objects of a certain kind.

Objects:

Objects serve as a fundamental building block in Object-Oriented Programming and symbolizes actual people and things.

Question 16: List out some areas in which data structures are applied extensively.

Answer:

Some common areas where data structures are used extensively are:

  • Compiler Design.
  • Operating System.
  • DBMS.
  • Graphics.
  • Simulation.
  • Numerical Analysis.

Question 17: What do you mean by a user-defined exception in JAVA programming?

Answer:

A user-defined exception, also known as a custom exception, is created by creating your own exception class and throwing that exception using the ‘throw’ keyword. This can be accomplished by extending the Exception class.

Question 18: What are insertion sort and bubble sorts?

Answer:

Bubble sort:

Bubble sort is a basic sorting algorithm that continuously checks a list, comparing neighboring pairings, and exchanging them if they are out of order.

Insertion sort:

Insertion sort is a simple sorting algorithm that transfers one element at a time to create the final sorted list.

Question 19: Define the data abstraction. Mention the different levels of data abstraction.

Answer:

The process of hiding unwanted or irrelevant details from the end-user is known as data abstraction. It offers a different perspective and aids in the achievement of data independence, which is used to improve data security. Database systems are made up of intricate data structures and relations.

Different levels of abstraction are:

  • View Level
  • Conceptual Level
  • Physical Level

Question 20: What Are Real-time Systems?

Answer:

Real-time systems are used when strict time restrictions are imposed on the operation of a processor. It is subject to strict time constraints.