Genpact
Interview Questions and Answers
Q1. What are indexes in the database? what is the difference between clustered and non-clustered indexes?
Indexes are used to improve database performance. Clustered indexes determine the physical order of data, while non-clustered indexes do not.
Indexes are used to speed up data retrieval operations in a database.
Clustered indexes determine the physical order of data in a table, while non-clustered indexes do not.
A table can have only one clustered index, but multiple non-clustered indexes.
Clustered indexes are generally faster for retrieving large ranges of data, while non-clus...read more
Q2. what is a singleton pattern and how to implement it?
Singleton pattern restricts the instantiation of a class to a single instance and provides a global point of access to it.
Create a private constructor to restrict instantiation of the class
Create a private static instance of the class
Create a public static method to access the instance
Ensure thread safety if necessary
Examples: Database connection, Logger, Configuration settings
Q3. How do you handle exceptions in stored procedures?
Handle exceptions in stored procedures by using TRY-CATCH blocks.
Use TRY-CATCH blocks to catch and handle exceptions
Log the error message and severity level
Rollback the transaction if necessary
Rethrow the error if it cannot be handled
Use RAISERROR to raise custom error messages
Q4. Write a query to delete duplicate rows from a table.
Query to delete duplicate rows from a table
Use GROUP BY clause to group the rows by their unique values
Use HAVING clause to filter out the groups with count greater than 1
Use DELETE statement to delete the duplicate rows
Q5. Difference between throw and throw exception?
throw is used to throw an exception while throw exception is used to throw a specific exception.
throw is used to throw any type of exception while throw exception is used to throw a specific type of exception.
throw exception is followed by the type of exception that needs to be thrown.
throw can be used to throw any object while throw exception can only be used to throw an exception object.
Example: throw new Exception("Something went wrong");
Example: throw ex;
Q6. Explain SOLID principles.
SOLID principles are a set of five design principles that help in creating maintainable and scalable software.
S - Single Responsibility Principle: A class should have only one reason to change.
O - Open-Closed Principle: Software entities should be open for extension but closed for modification.
L - Liskov Substitution Principle: Subtypes should be substitutable for their base types.
I - Interface Segregation Principle: Clients should not be forced to depend on interfaces they d...read more
More about working at Genpact
Top Senior Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month