TCS
SenseHR Interview Questions and Answers
Q1. What is inheritance and type of
Inheritance is a concept in object-oriented programming where a class can inherit attributes and methods from another class.
Inheritance allows for code reusability and promotes a hierarchical relationship between classes.
There are different types of inheritance such as single inheritance, multiple inheritance, multilevel inheritance, and hierarchical inheritance.
Example: Class B inheriting from Class A - 'class B extends A'
Example: Class C inheriting from Class A and Class B ...read more
Q2. What is class and how to create
A class is a blueprint for creating objects in object-oriented programming.
Classes define the properties and behaviors of objects.
To create a class, use the 'class' keyword followed by the class name and curly braces.
Inside the class, you can define attributes (variables) and methods (functions).
Example: class Car { String color; void start() { //code here } }
Q3. What is poly morph sm
Polymorphism is a concept in object-oriented programming where a single function or method can operate on different types of data.
Polymorphism allows for flexibility and reusability in code
There are two types of polymorphism: compile-time (method overloading) and runtime (method overriding)
Example: a function that can calculate the area of different shapes (circle, square, triangle) based on the input type
Q4. What are the data type
Data types are classifications that specify which type of value a variable can hold.
Data types include integers, floating point numbers, characters, strings, and booleans.
Examples of data types are int (for integers), float (for floating point numbers), char (for characters), and bool (for booleans).
Q5. What is join in sql
Join in SQL is used to combine rows from two or more tables based on a related column between them.
Join is used to retrieve data from multiple tables based on a related column
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
Q6. SWAP program for two variables
A SWAP program exchanges the values of two variables without using a temporary variable.
Use XOR operation to swap two variables without using a temporary variable.
Example: a = 5, b = 10. After swapping, a = 10, b = 5.
Ensure to handle cases where the variables are the same.
More about working at TCS
Reviews
Interviews
Salaries
Users/Month