Add office photos
Engaged Employer

TCS

3.7
based on 88.9k Reviews
Video summary
Filter interviews by

100+ TCS Interview Questions and Answers

Updated 20 Jan 2025
Popular Designations

Q101. What is a Constructor

Ans.

A constructor is a special type of method in a class that is automatically called when an object of that class is created.

  • Constructors have the same name as the class they belong to

  • They are used to initialize the object's state

  • They can have parameters to customize the initialization process

Add your answer

Q102. Write a Plindrome Code

Ans.

A palindrome code reads the same forwards and backwards.

  • Create a function that compares the original string with its reverse

  • Use built-in functions like reverse() or loop through the string to create the reversed version

  • Handle cases where spaces or punctuation may be present in the string

Add your answer

Q103. 2) how to reverse a string

Ans.

To reverse a string, iterate through it in reverse order and append each character to a new string.

  • Create an empty string to store the reversed string

  • Iterate through the original string in reverse order using a loop

  • Append each character to the new string using the += operator

  • Return the reversed string

Add your answer

Q104. Are you good at programming

Ans.

Yes, I am proficient in programming with experience in multiple languages and projects.

  • Proficient in multiple programming languages such as Python, Java, and C++

  • Experience working on various projects including web development, data analysis, and software engineering

  • Strong problem-solving skills and ability to write efficient and clean code

View 1 answer
Discover TCS interview dos and don'ts from real experiences

Q105. Where did you learnt coding

Ans.

I learned coding through online courses, coding bootcamps, and self-study.

  • Took online courses on platforms like Coursera, Udemy, and Codecademy

  • Attended a coding bootcamp to gain hands-on experience and mentorship

  • Self-studied using resources like books, tutorials, and coding challenges

Add your answer

Q106. Can you explain oops concepts

Ans.

OOPs concepts refer to Object-Oriented Programming principles like Inheritance, Encapsulation, Polymorphism, and Abstraction.

  • Inheritance: Allows a class to inherit properties and behavior from another class. Example: Parent class 'Animal' and child class 'Dog'.

  • Encapsulation: Bundling data and methods that operate on the data into a single unit. Example: Class 'Car' with private variables and public methods.

  • Polymorphism: Ability to present the same interface for different data...read more

Add your answer
Are these interview questions helpful?

Q107. What are joins in SQL.

Ans.

Joins in SQL are used to combine rows from two or more tables based on a related column between them.

  • Joins are used to retrieve data from multiple tables based on a related column

  • Common types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN

  • Example: SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column

Add your answer

Q108. DDL and DML difference

Ans.

DDL is used to create, modify or delete database objects while DML is used to manipulate data within those objects.

  • DDL stands for Data Definition Language and includes commands like CREATE, ALTER, DROP, etc.

  • DML stands for Data Manipulation Language and includes commands like SELECT, INSERT, UPDATE, DELETE, etc.

  • DDL commands are used to create, modify or delete database objects like tables, indexes, etc.

  • DML commands are used to manipulate data within those objects like insertin...read more

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q109. What is Deep Learning

Ans.

Deep learning is a subset of machine learning that uses neural networks to learn from large amounts of data.

  • Deep learning is a type of machine learning that uses neural networks with multiple layers to learn patterns from data

  • It is particularly effective for tasks such as image and speech recognition, natural language processing, and autonomous driving

  • Examples of deep learning frameworks include TensorFlow, PyTorch, and Keras

Add your answer

Q110. What is oops. Explain.

Ans.

Oops stands for Object-Oriented Programming. It is a programming paradigm that uses objects to represent and manipulate data.

  • Oops is a programming paradigm

  • It focuses on using objects to represent data and perform operations

  • It promotes code reusability, modularity, and flexibility

  • Examples of object-oriented programming languages include Java, C++, and Python

Add your answer

Q111. explain different types of JOIN in dbms

Ans.

Different types of JOIN in DBMS include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.

  • INNER JOIN: Returns rows when there is at least one match in both tables.

  • LEFT JOIN: Returns all rows from the left table and the matched rows from the right table.

  • RIGHT JOIN: Returns all rows from the right table and the matched rows from the left table.

  • FULL JOIN: Returns rows when there is a match in one of the tables.

Add your answer

Q112. 1. Write a program to find prime number

Ans.

A program to find prime numbers in a given range or up to a certain number.

  • Iterate through numbers from 2 to n, checking if each number is divisible by any number from 2 to its square root.

  • Use a boolean array to mark non-prime numbers and return the list of prime numbers.

  • Optimize by only checking odd numbers after 2, as all other even numbers are not prime.

Add your answer

Q113. PRINT REPEATING ELEMNTS IN AN ARRAY

Ans.

Print repeating elements in an array of strings

  • Iterate through the array and use a hashmap to store the frequency of each element

  • Print elements with frequency greater than 1

Add your answer

Q114. Check if a number is a palindrome

Ans.

A palindrome number is the same when read forwards and backwards.

  • Convert the number to a string to easily check for palindrome

  • Reverse the string and compare it with the original string to check for palindrome

  • If the reversed string is equal to the original string, then the number is a palindrome

Add your answer

Q115. OOPS in JAVA, explain in details

Ans.

OOPS in JAVA refers to Object-Oriented Programming concepts like classes, objects, inheritance, polymorphism, and encapsulation.

  • OOPS stands for Object-Oriented Programming

  • Key concepts include classes, objects, inheritance, polymorphism, and encapsulation

  • Java is an object-oriented programming language that follows OOPS principles

  • Example: Creating a class 'Car' with properties like 'make', 'model', and methods like 'drive', 'stop'

Add your answer

Q116. Difference between tuple and list

Ans.

Tuple is immutable and ordered while list is mutable and ordered.

  • Tuple uses () while list uses []

  • Tuple is faster than list for accessing elements

  • Tuple can be used as keys in dictionaries while list cannot

  • Tuple is used for heterogeneous data while list is used for homogeneous data

Add your answer

Q117. Oops concepts (explain with example)

Ans.

Oops concepts are fundamental principles of object-oriented programming that help in organizing and designing code.

  • Encapsulation: Bundling data and methods that operate on the data into a single unit (class). Example: Class Car with properties like make, model, and methods like start(), stop().

  • Inheritance: Allows a class to inherit properties and behavior from another class. Example: Class Truck inheriting from class Vehicle.

  • Polymorphism: Ability of objects to take on multipl...read more

Add your answer

Q118. reverse a string

Ans.

Reverse a given string

  • Use a loop to iterate through the characters of the string

  • Append each character to a new string in reverse order

  • Return the reversed string

View 1 answer

Q119. tell about http vs ip

Ans.

HTTP is a protocol used for transferring data over the internet, while IP is a unique address assigned to devices on a network.

  • HTTP stands for Hypertext Transfer Protocol and is used for transmitting web pages, images, videos, etc. between a web server and a client's browser.

  • IP stands for Internet Protocol and is a numerical label assigned to each device connected to a network to identify and locate them.

  • HTTP operates at the application layer of the OSI model, while IP operat...read more

Add your answer

Q120. string regex ques to sanitise string

Ans.

Use regular expressions to sanitize strings by removing unwanted characters or patterns.

  • Use regex patterns to match and replace unwanted characters or patterns in the string.

  • For example, to remove all non-alphanumeric characters from a string: str.replace(/[^a-zA-Z0-9]/g, '')

  • Be careful with regex patterns to ensure that only the intended characters are removed.

Add your answer

Q121. what is oops in c++?

Ans.

Oops in C++ stands for Object-Oriented Programming System. It is a programming paradigm that uses objects and classes for data organization and manipulation.

  • Oops in C++ allows for encapsulation, inheritance, and polymorphism.

  • Classes in C++ are used to create objects, which can have attributes (data members) and behaviors (member functions).

  • Example: class Car { private: int speed; public: void accelerate() { speed += 10; } };

  • Example: Car myCar; myCar.accelerate();

Add your answer

Q122. State full or stateless difference

Ans.

Stateful vs stateless refers to whether or not the server retains information about the client between requests.

  • Stateful: Server retains client information between requests

  • Stateless: Server does not retain client information between requests

  • Stateful example: HTTP cookies

  • Stateless example: RESTful APIs

Add your answer

Q123. Write code check for palindrome

Ans.

Code to check if a given array of strings are palindromes

  • Iterate through each string in the array

  • Reverse the string and compare it with the original string to check for palindrome

  • Return true if it is a palindrome, false otherwise

Add your answer

Q124. What are keys in sql

Ans.

Keys in SQL are used to uniquely identify rows in a table and establish relationships between tables.

  • Keys ensure data integrity by enforcing uniqueness and relationships between tables

  • Primary key uniquely identifies each row in a table

  • Foreign key establishes a relationship between two tables

Add your answer

Q125. What is Gen AI

Ans.

Gen AI refers to the next generation of artificial intelligence that is capable of learning, adapting, and evolving on its own.

  • Gen AI utilizes advanced machine learning algorithms to continuously improve its performance

  • It can analyze vast amounts of data to make predictions and decisions

  • Gen AI has the potential to revolutionize industries such as healthcare, finance, and transportation

Add your answer

Q126. inheritance and polymorphism difference

Ans.

Inheritance is a way to create a new class from an existing class while polymorphism is the ability of an object to take on many forms.

  • Inheritance allows a subclass to inherit properties and methods from a superclass.

  • Polymorphism allows objects of different classes to be treated as if they are of the same class.

  • Inheritance is a way to achieve code reusability while polymorphism allows for flexibility in code design.

  • Example of inheritance: class Dog extends Animal

  • Example of po...read more

Add your answer

Q127. what is overriding

Ans.

Overriding is a concept in object-oriented programming where a subclass provides a specific implementation of a method that is already provided by its superclass.

  • Occurs in inheritance when a subclass provides a specific implementation of a method that is already provided by its superclass

  • The method in the subclass must have the same name, return type, and parameters as the method in the superclass

  • Allows for polymorphism, where a subclass can be treated as an instance of its s...read more

Add your answer

Q128. What is constructor

Ans.

A constructor is a special type of method in a class that is automatically called when an object of that class is created.

  • Constructors have the same name as the class they belong to

  • They can be used to initialize object properties

  • They do not have a return type

  • Example: public class Car { public Car() { // constructor code here }}

Add your answer

Q129. Java and polymorphism in it

Ans.

Java supports polymorphism, allowing objects of different classes to be treated as objects of a common superclass.

  • Polymorphism is achieved through method overriding and method overloading.

  • Polymorphism allows for code reusability and flexibility.

  • Example: Animal class with subclasses like Dog and Cat, where they can be treated as objects of the Animal class.

Add your answer

Q130. Explain the concept on OOP

Ans.

OOP is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.

  • OOP focuses on creating objects that interact with each other to solve problems.

  • Objects have attributes (data) and methods (functions) that define their behavior.

  • Encapsulation, inheritance, and polymorphism are key principles of OOP.

  • Example: In a car simulation program, a 'Car' object could have attributes like 'color' and 'speed', and...read more

Add your answer

Q131. Osi layer in serial order

Ans.

The OSI layer in serial order refers to the Open Systems Interconnection model which is a conceptual framework used to understand network communication.

  • Physical Layer

  • Data Link Layer

  • Network Layer

  • Transport Layer

  • Session Layer

  • Presentation Layer

  • Application Layer

Add your answer

Q132. Abstraction vs interface

Ans.

Abstraction focuses on hiding implementation details, while interfaces define a contract for classes to implement.

  • Abstraction allows for defining common behavior without specifying implementation details

  • Interfaces define a set of methods that a class must implement, providing a contract for how the class should behave

  • Abstraction can be achieved through abstract classes in languages like Java

  • Interfaces are used to achieve multiple inheritance in languages like C#

Add your answer

Q133. reverse string in c++

Ans.

To reverse a string in C++, you can use the reverse function from the algorithm library.

  • Include the algorithm header file: #include

  • Use the reverse function with begin() and end() iterators

  • Example: string str = 'hello'; reverse(str.begin(), str.end());

Add your answer

Q134. Find duplicate in list

Ans.

Find duplicates in a list of strings

  • Iterate through the array and store each element in a hash set

  • If an element is already in the hash set, it is a duplicate

Add your answer

Q135. write programs

Ans.

Yes, I can write programs in various programming languages.

  • Proficient in languages like Python, Java, C++, etc.

  • Experience with data structures and algorithms

  • Able to develop web applications, mobile apps, and more

Add your answer

Q136. reverse a string

Ans.

A function that reverses a given string and returns it.

  • Create an empty string to store the reversed string

  • Iterate through the input string from the end to the beginning and append each character to the new string

  • Return the reversed string

Add your answer

Q137. reverse array in c++

Ans.

To reverse an array of strings in C++, use the std::reverse function.

  • Include the header to use the std::reverse function.

  • Call std::reverse with the beginning and ending iterators of the array.

  • Example: std::reverse(arr.begin(), arr.end());

Add your answer

Q138. Projects during ug

Ans.

I worked on various projects during my undergraduate studies.

  • Developed a mobile app for a class project

  • Participated in a research study on environmental sustainability

  • Collaborated with classmates on a group presentation for a business course

Add your answer

Q139. Favourite language

Ans.

My favorite language is Python.

  • Python is a versatile and powerful programming language.

  • It has a simple and readable syntax, making it easy to learn and use.

  • Python has a vast ecosystem of libraries and frameworks for various purposes.

  • It is widely used in fields like web development, data analysis, and artificial intelligence.

  • Python's popularity and community support make it a great choice for developers.

Add your answer
1
2
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter