Genpact
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
I applied via Naukri.com and was interviewed in Jun 2024. There were 3 interview rounds.
List comprehension is a concise way to create lists in programming languages like Python.
List comprehension is a compact way to generate lists by applying an expression to each item in a sequence.
It is commonly used in Python and allows for more readable and efficient code.
Example: squares = [x**2 for x in range(10)] will create a list of squares of numbers from 0 to 9.
List is mutable, tuple is immutable in Python.
List can be modified after creation, tuple cannot.
List uses square brackets [], tuple uses parentheses ().
List is used for collections of items that may change, tuple for fixed collections.
Coding related to list comprehension and searching an item.
To check if two strings are anagrams, connect two databases in Spring, and reload configuration without downtime in Spring.
To check if two strings are anagrams, use Java Collection Framework to compare the characters in both strings.
To connect two databases in Spring, configure multiple data sources in the application context file.
To reload configuration in Spring without downtime, use Spring Cloud Config to externaliz
posted on 29 Jun 2024
I applied via Referral and was interviewed in May 2024. There was 1 interview round.
I applied via Naukri.com and was interviewed in Nov 2024. There was 1 interview round.
Custom hooks in React are reusable functions that allow you to extract component logic into separate functions for better code organization and reusability.
Custom hooks are created using the 'use' prefix and can be used to share logic between components.
Use cases for custom hooks include fetching data from an API, handling form state, managing local storage, and more.
Example of a custom hook for API call: const useFetc...
useMemo is used to memoize a value, while useCallback is used to memoize a function.
useMemo is used to memoize a value and recompute it only when its dependencies change.
useCallback is used to memoize a callback function and prevent unnecessary re-renders.
Example: useMemo can be used to memoize the result of a complex computation, while useCallback can be used to memoize an event handler function.
Class-based components use ES6 classes and have lifecycle methods, while functional components are simpler and use functions.
Class-based components use ES6 classes to create components, while functional components are created using functions.
Class-based components have lifecycle methods like componentDidMount and componentDidUpdate, while functional components do not.
Functional components are simpler and more lightweig...
Implementing the lifecycle of a React component in a functional component
Use the useEffect hook to replicate lifecycle methods like componentDidMount, componentDidUpdate, and componentWillUnmount
Pass an empty array as the second argument to useEffect to mimic componentDidMount
Pass a variable or state as the second argument to useEffect to mimic componentDidUpdate
Return a cleanup function inside useEffect to mimic compo
Various state management techniques in React include Context API, Redux, and local state.
Context API: React's built-in solution for passing data through the component tree without having to pass props down manually at every level.
Redux: A popular state management library for React applications, allowing for a centralized store to manage application state.
Local state: Managing state within individual components using us
Redux is a predictable state container for JavaScript apps. Middlewares are functions that intercept actions before they reach the reducer.
Redux follows a unidirectional data flow architecture.
Middlewares in Redux are functions that can intercept, modify, or dispatch actions.
Common use cases for middlewares include logging, asynchronous API calls, and handling side effects.
Examples of popular Redux middlewares are Redu...
Hoisting in JavaScript is the behavior where variable and function declarations are moved to the top of their containing scope during the compilation phase.
Variable declarations are hoisted to the top of their scope, but not their initializations.
Function declarations are fully hoisted, meaning they can be called before they are declared.
Hoisting can lead to unexpected behavior if not understood properly.
Event bubbling is the propagation of events from the target element up through its ancestors in the DOM tree.
Events triggered on a child element will 'bubble up' and trigger on parent elements.
Event listeners can be attached to parent elements to handle events from multiple child elements.
Stopping event propagation can be done using event.stopPropagation() or event.stopImmediatePropagation().
Block scope and function scope are two types of scopes in JavaScript that determine the visibility and accessibility of variables.
Block scope refers to the visibility of variables within a block of code enclosed by curly braces. Variables declared with 'let' and 'const' have block scope.
Function scope refers to the visibility of variables within a function. Variables declared with 'var' have function scope.
Variables de...
Yes, I have experience working with semantic tags in HTML.
Used semantic tags like <header>, <nav>, <main>, <section>, <article>, <aside>, <footer> for better structure and SEO.
Understand the importance of using semantic tags for accessibility and search engine optimization.
Semantic tags help in organizing content and making it more readable for developers and browsers.
Various methods for creating an object in JavaScript include object literals, constructor functions, ES6 classes, and Object.create() method.
Object literals: var obj = { key: value };
Constructor functions: function ObjectName() { this.key = value; } var obj = new ObjectName();
ES6 classes: class ClassName { constructor() { this.key = value; } } var obj = new ClassName();
Object.create() method: var obj = Object.create(pr
Shallow copy only copies the references of nested objects, while deep copy creates new copies of nested objects.
Shallow copy creates a new object but does not create copies of nested objects, only copies their references.
Deep copy creates a new object and also creates new copies of all nested objects.
Shallow copy can be achieved using Object.assign() or spread operator, while deep copy can be achieved using JSON.parse(
The code will throw an error because 'a' is declared but not initialized.
The code will result in a ReferenceError because 'a' is declared but not assigned a value.
Variables declared with 'const' must be initialized at the time of declaration.
Initializing 'a' with a value before calling test() will prevent the error.
CSS can be used to arrange elements in a row and column layout using flexbox or grid layout properties.
Use display: flex; for a row layout and display: flex; flex-direction: column; for a column layout
Use justify-content and align-items properties to align items in the main axis and cross axis respectively
For grid layout, use display: grid; and grid-template-columns or grid-template-rows to define the layout
Yes, I have utilized CSS preprocessors such as SASS and LESS.
I have experience using SASS to streamline my CSS workflow by utilizing variables, mixins, and nesting.
I have also worked with LESS to improve code organization and maintainability through features like variables and functions.
The color applied will be based on the specificity of the selector, with ID having higher specificity than class.
ID has higher specificity than class in CSS
Color applied will be based on the selector with higher specificity
Example: If ID selector has color red and class selector has color blue, the color applied will be red
I was interviewed in Jan 2025.
ArrayList is preferred for frequent retrieval operations due to fast random access, while LinkedList is suitable for frequent insertions/deletions.
Use ArrayList when frequent retrieval operations are required, such as searching for elements in a large collection.
Choose LinkedList when frequent insertions/deletions are needed, like maintaining a queue or stack.
Consider memory overhead and performance trade-offs when dec...
ReentrantLock should be used instead of synchronized when more flexibility and control over locking mechanisms is needed.
Use ReentrantLock when you need to implement custom locking strategies or require advanced features like tryLock() and lockInterruptibly().
ReentrantLock supports fair locking mechanisms, ensuring that threads acquire the lock in the order they requested it.
Explicit unlocking in ReentrantLock reduces ...
In Java, == checks for reference equality while equals() checks for value equality. Misuse of == can lead to logical errors.
Override equals() when you want to compare the values of objects instead of their references
Override hashCode() alongside equals() to ensure proper functioning in collections like HashMap
Consider implementing Comparable interface for natural ordering in collections
Garbage collection in Java automatically reclaims memory occupied by unused objects using different algorithms and memory regions.
Java garbage collector automatically reclaims memory from unused objects
Different types of GC algorithms in JVM: Serial, Parallel, CMS, G1 GC
Objects managed in Young Generation, Old Generation, and PermGen/Metaspace
Minor GC cleans up short-lived objects in Young Generation
Major GC (Full GC) ...
Lambda expressions in Java 8 improve readability and maintainability by enabling concise and functional-style programming.
Lambda expressions allow writing more compact code by reducing boilerplate code.
They enable passing behavior as arguments to methods, making code more modular and flexible.
Example: (a, b) -> a + b is a lambda expression that adds two numbers.
Checked exceptions must be handled explicitly, while unchecked exceptions do not require explicit handling.
Use custom exceptions when you want to create your own exception types to handle specific scenarios.
Custom exceptions can be either checked or unchecked, depending on whether you want to enforce handling or not.
For example, a custom InvalidInputException could be a checked exception if you want to ensure it is cau...
The Java Memory Model defines how threads interact with shared memory, ensuring visibility and ordering of variable updates in a concurrent environment.
Volatile keyword ensures changes to a variable are always visible to all threads.
Synchronized keyword provides mutual exclusion and visibility guarantees.
Reordering optimizations by the compiler or CPU can lead to unexpected behavior.
Happens-before relationship determin...
Method overloading allows multiple methods with the same name but different parameters, while method overriding allows a subclass to provide a different implementation of a parent method.
Use method overloading when you want to provide multiple ways to call a method with different parameters.
Use method overriding when you want to provide a specific implementation of a method in a subclass.
Example of method overloading: ...
Functional interfaces in Java have exactly one abstract method and work with lambda expressions for concise implementation.
Functional interfaces have exactly one abstract method, such as Runnable, Callable, Predicate, and Function.
Lambda expressions provide a concise way to implement functional interfaces.
Default methods in interfaces help in evolving APIs without breaking backward compatibility.
Method references (::) ...
Java Streams enable functional-style operations on collections with lazy evaluation, unlike Iterators.
Parallel streams can improve performance by utilizing multiple threads, but may introduce overhead due to thread management.
Care must be taken to ensure thread safety when using parallel streams in a multi-threaded environment.
Parallel streams are suitable for operations that can be easily parallelized, such as map and...
Immutability in Java prevents objects from being changed after creation, promoting thread safety and preventing unintended side effects.
Immutable objects cannot be modified after creation, promoting thread safety
String class in Java is immutable, modifications create new objects
Use final fields and avoid setters to create immutable classes
Collections can be made immutable using Collections.unmodifiableList()
Immutabilit...
final, finally, and finalize have different meanings in Java. final is for constants, finally for cleanup, and finalize for garbage collection.
final is used for constants, preventing method overriding, and inheritance
finally is used for cleanup actions after a try-catch block
finalize() is called by the garbage collector before object deletion
Alternatives to finalize() for resource management include using try-with-reso...
Singleton design pattern ensures only one instance of a class exists in the JVM, useful for managing shared resources like database connections.
Avoid using Singleton when multiple instances of a class are required.
Avoid Singleton for classes that are not thread-safe.
Avoid Singleton for classes that need to be easily mockable for testing purposes.
Java annotations provide metadata to classes, methods, and fields, improving code readability and maintainability.
Annotations like @Component, @Service, and @Autowired in Spring help with dependency injection
Annotations reduce boilerplate code compared to XML configurations
Custom annotations can be created using @interface
Reflection APIs allow reading annotation metadata dynamically
Annotations like @Transactional simpl
Java Streams handle parallel processing by dividing data into multiple threads using the ForkJoin framework. Pitfalls include race conditions, performance issues with small datasets, and debugging challenges.
Parallel streams divide data into multiple threads for faster processing
ForkJoin framework handles parallel execution internally
Useful for CPU-intensive tasks but may not improve performance for small datasets
Share...
I applied via Referral and was interviewed in Oct 2024. There was 1 interview round.
Java 8 introduced several new features including lambda expressions, streams, and functional interfaces.
Lambda expressions: Allow for more concise and readable code by enabling functional programming.
Streams: Provide a way to work with collections of objects in a more functional style.
Functional interfaces: Interfaces with a single abstract method, used to enable lambda expressions.
Optional class: Helps to avoid null p...
Spring boot annotations are used to simplify the development process by providing metadata to the Spring framework.
1. @SpringBootApplication - Main annotation to indicate the main class of a Spring Boot application.
2. @RestController - Annotation for RESTful web services.
3. @Autowired - Dependency injection annotation.
4. @GetMapping, @PostMapping, @PutMapping, @DeleteMapping - Annotations for mapping HTTP requests to c...
String Builder is not synchronized and faster, while String Buffer is synchronized and slower.
String Builder is not thread-safe, while String Buffer is thread-safe.
String Builder is faster due to lack of synchronization, while String Buffer is slower due to synchronization.
String Builder is recommended for single-threaded operations, while String Buffer is recommended for multi-threaded operations.
String pool is a storage area in memory where strings are stored to optimize memory usage by reusing common strings.
String pool helps in reducing memory usage by storing only one copy of each unique string.
Strings created using double quotes are stored in the string pool.
Strings created using new keyword are not stored in the string pool.
There are two main types of memory in a computer system: stack memory and heap memory.
Stack memory is used for static memory allocation and is managed by the compiler. It is typically faster but limited in size.
Heap memory is used for dynamic memory allocation and is managed by the programmer. It is slower but has a larger size.
Examples: C programming language uses stack memory for function calls and heap memory for dy
I was interviewed in Dec 2024.
posted on 12 Nov 2024
It was an aptitute round and 2 coding questions was there
based on 1 interview
Interview experience
Process Developer
36.3k
salaries
| ₹1 L/yr - ₹6.8 L/yr |
Process Associate
28.1k
salaries
| ₹0.9 L/yr - ₹6.5 L/yr |
Assistant Manager
19.9k
salaries
| ₹5 L/yr - ₹14 L/yr |
Management Trainee
19.4k
salaries
| ₹1.6 L/yr - ₹8.5 L/yr |
Manager
7.4k
salaries
| ₹5.7 L/yr - ₹24 L/yr |
Accenture
Capgemini
TCS
Cognizant