PIT Solutions
TCI Foundation Interview Questions and Answers
Q1. Explain inheritance with example
Inheritance is a concept in object-oriented programming where a class inherits properties and behaviors from another class.
Allows a class to inherit attributes and methods from another class
Promotes code reusability and reduces redundancy
Derived class can add its own attributes and methods or override existing ones
Example: Class 'Animal' can be a base class with attributes like 'name' and methods like 'eat'. Class 'Dog' can inherit from 'Animal' and add its own method 'bark'
Q2. Explain polymorphism in Java
Polymorphism in Java allows objects of different classes to be treated as objects of a common superclass.
Polymorphism is achieved through method overriding and method overloading.
Method overriding allows a subclass to provide a specific implementation of a method that is already provided by its superclass.
Method overloading allows multiple methods with the same name but different parameters to coexist in the same class.
Polymorphism helps in achieving flexibility and reusabili...read more
Q3. Oops concepts in detail
Oops concepts are fundamental principles of object-oriented programming like inheritance, polymorphism, encapsulation, and abstraction.
Inheritance: Allows a class to inherit properties and behavior from another class.
Polymorphism: Ability to present the same interface for different data types.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Abstraction: Hiding the complex implementation details and showing only the necessary features.
Q4. Access modifiers in detail
Access modifiers control the visibility and accessibility of classes, methods, and variables in object-oriented programming.
There are four types of access modifiers in Java: public, private, protected, and default.
Public: accessible from any other class.
Private: accessible only within the same class.
Protected: accessible within the same package and subclasses.
Default: accessible only within the same package.
Access modifiers help enforce encapsulation and prevent unauthorized ...read more
Q5. Oops concept in Java
Oops concept in Java refers to Object-Oriented Programming principles like Inheritance, Encapsulation, Polymorphism, and Abstraction.
Inheritance allows a class to inherit properties and behavior from another class.
Encapsulation involves bundling data and methods that operate on the data into a single unit.
Polymorphism allows objects to be treated as instances of their parent class.
Abstraction hides the implementation details and only shows the necessary features to the outsid...read more
Q6. Write a C program for obtaing an factorial of a number
A C program to calculate the factorial of a number.
Use a loop to multiply the number with all the numbers from 1 to the given number.
Handle the case when the number is 0 or negative separately.
Use a variable to store the factorial value and update it in each iteration of the loop.
Q7. write query for select second highest salary from table
Query to select second highest salary from a table
Use ORDER BY clause to sort salaries in descending order
Use LIMIT to select the second row after skipping the first row
Q8. What is indexing,trigger,stored procedure
Indexing, triggers, and stored procedures are database concepts used to optimize performance and automate tasks.
Indexing is a technique used to improve the speed of data retrieval operations in a database by creating indexes on columns.
Triggers are special types of stored procedures that are automatically executed in response to certain events on a table, such as insert, update, or delete operations.
Stored procedures are precompiled SQL statements that are stored in the datab...read more
More about working at PIT Solutions
Interview Process at TCI Foundation
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month