
Capgemini


100+ Capgemini Senior Software Engineer Interview Questions and Answers
Q1. Pascal's Triangle Construction
You are provided with an integer 'N'. Your task is to generate a 2-D list representing Pascal’s triangle up to the 'N'th row.
Pascal's triangle is a triangular array where each el...read more
Generate Pascal's triangle up to the Nth row using a 2-D list.
Iterate through each row up to N, starting with [1] as the first row.
Calculate each element in a row by summing the two elements directly above from the previous row.
Append each row to the 2-D list until reaching the Nth row.
Example: For N = 4, the output would be [ [1], [1, 1], [1, 2, 1], [1, 3, 3, 1] ]
Q2. Trailing Zeros in Factorial Problem
Find the number of trailing zeroes in the factorial of a given number N
.
Input:
The first line contains an integer T
representing the number of test cases.
Each of the followi...read more
Count the number of trailing zeros in the factorial of a given number.
Calculate the number of 5's in the prime factorization of N to find the number of trailing zeros.
Divide N by 5, then by 25, then by 125, and so on, and sum up the quotients to get the answer.
Example: For N=10, 10/5=2, so there are 2 trailing zeros in 10!.
Q3. Kth Largest Number Problem Statement
You are given a continuous stream of numbers, and the task is to determine the kth largest number at any moment during the stream.
Explanation:
A specialized data structure ...read more
Design a data structure to find the kth largest number in a continuous stream of integers.
Design a specialized data structure to handle an indefinite number of integers from the stream.
Implement 'add(DATA)' to incorporate integers into the stream's pool.
Implement 'getKthLargest()' to retrieve the kth largest number from the pool.
Maintain the pool of numbers and return the kth largest number for each query.
Ensure efficient implementation to handle large input sizes.
An interface in OOP defines a contract for classes to implement, specifying methods that must be included.
An interface contains method signatures but no implementation details.
Classes can implement multiple interfaces in Java.
Interfaces allow for polymorphism and loose coupling in software design.
Q5. Count Inversions Problem Statement
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the array ...read more
Count the total number of inversions in an integer array.
Iterate through the array and for each pair of elements, check if the inversion condition is met.
Use a nested loop to compare each pair of elements efficiently.
Keep a count of the inversions found and return the total count at the end.
Q6. Next Greater Element Problem Statement
Given a list of integers of size N
, your task is to determine the Next Greater Element (NGE) for every element. The Next Greater Element for an element X
is the first elem...read more
The task is to find the Next Greater Element for each element in a list of integers.
Iterate through the list of integers from right to left
Use a stack to keep track of elements for which the Next Greater Element is not yet found
Pop elements from the stack until a greater element is found or the stack is empty
Q7. Kth Largest Element Problem Statement
Ninja enjoys working with numbers, and Alice challenges him to find the Kth largest value from a given list of numbers.
Input:
The first line contains an integer 'T', repre...read more
The task is to find the Kth largest element in a given list of numbers for each test case.
Read the number of test cases 'T'
For each test case, read the number of elements 'N' and the value of 'K'
Sort the array in descending order and output the Kth element
Q8. Find All Pairs Adding Up to Target
Given an array of integers ARR
of length N
and an integer Target
, your task is to return all pairs of elements such that they add up to the Target
.
Input:
The first line conta...read more
The task is to find all pairs of elements in an array that add up to a given target.
Iterate through the array and for each element, check if the target minus the element exists in a hashmap.
If it exists, print the pair (current element, target - current element).
If no pair is found, print (-1, -1).
Q9. Find Terms of Series Problem
Ayush is tasked with determining the first 'X' terms of the series defined by 3 * N + 2, ensuring that no term is a multiple of 4.
Input:
The first line contains a single integer 'T...read more
Generate the first 'X' terms of a series 3 * N + 2, excluding multiples of 4.
Iterate through numbers starting from 1 and check if 3 * N + 2 is not a multiple of 4.
Keep track of the count of terms generated and stop when 'X' terms are found.
Return the list of terms that meet the criteria for each test case.
Q10. Find Duplicates in an Array
You are given an array/list ARR
consisting of N integers, where each element is in the range 0 to N - 1. Your task is to identify all duplicate elements present in ARR
.
Input:
The fi...read more
Find duplicates in an array of integers within a specified range.
Iterate through the array and keep track of seen elements using a hash set.
For each element, check if it has been seen before and add it to the result if it has.
Return the list of duplicate elements found in the array.
Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.
Abstract class can have constructor, fields, and methods, while interface cannot have any of these.
A class can implement multiple interfaces but can only inherit from one abstract class.
Abstract classes are used to provide a common base for related classes, while interfaces define a contract for classes to implement.
Example: Abstract class 'Shape' with abstract metho...read more
Clustered Index physically reorders the data in the table, while Non-Clustered Index creates a separate structure.
Clustered Index determines the physical order of data rows in a table.
Non-Clustered Index creates a separate structure that points back to the original table.
Clustered Index is faster for retrieval of data, while Non-Clustered Index is faster for retrieval of specific rows.
Example: Primary key in a table is usually implemented as a Clustered Index, while secondary...read more
DELETE removes specific rows from a table, while TRUNCATE removes all rows and resets auto-increment values.
DELETE is a DML command, while TRUNCATE is a DDL command.
DELETE can be rolled back, while TRUNCATE cannot be rolled back.
DELETE triggers ON DELETE triggers, while TRUNCATE does not trigger any triggers.
DELETE is slower as it logs individual row deletions, while TRUNCATE is faster as it logs the deallocation of data pages.
Example: DELETE FROM table_name WHERE condition; ...read more
Java is platform independent because it compiles code into bytecode that can run on any system with JVM, which is platform dependent.
Java code is compiled into bytecode, which is platform independent
JVM interprets bytecode and translates it into machine code specific to the underlying platform
JVM acts as a layer of abstraction between Java code and the operating system
Example: A Java program compiled on Windows can run on Linux as long as the JVM is installed
The starter dependency of the Spring Boot module is spring-boot-starter-parent.
The starter dependency of Spring Boot provides a set of default configurations and dependencies to kickstart a Spring Boot project.
It includes commonly used dependencies like spring-boot-starter-web, spring-boot-starter-data-jpa, etc.
The spring-boot-starter-parent also manages the versions of all dependencies to ensure compatibility.
Yes, we can override or replace the embedded Tomcat server in Spring Boot.
Spring Boot allows for customization of embedded servers through configuration properties.
You can replace Tomcat with other embedded servers like Jetty or Undertow.
Example: To use Jetty instead of Tomcat, exclude Tomcat dependencies and include Jetty dependencies in your pom.xml file.
The life cycle of a thread in Java involves creation, running, blocking, and termination.
A thread is created by instantiating a class that extends Thread or implements Runnable interface.
The thread starts running when the start() method is called, executing the run() method.
A thread can be blocked by calling sleep(), wait(), or join() methods.
A thread terminates when the run() method completes or when stop() method is called.
The @SpringBootApplication annotation is used to mark the main class of a Spring Boot application.
It is a combination of @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations.
It tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings.
It also implicitly provides a base package for component scanning.
Example: @SpringBootApplication
Example: @SpringBootApplication(scanBasePackages = "com.example")
Q19. Difference between procedure and function, delete and truncate, exit and in, cursor and bulk bind, cursor and collection, view and materialized view. How to avoid cross join. Different types of joins.
Explanation of differences between programming concepts and techniques.
Procedure vs Function: Functions return a value while procedures do not.
Delete vs Truncate: Delete removes rows one by one while truncate removes all rows at once.
Exit vs In: Exit is used to exit a loop or a program while In is used to pass values into a subprogram.
Cursor vs Bulk Bind: Cursor fetches one row at a time while Bulk Bind fetches multiple rows at once.
Cursor vs Collection: Cursor is used to fet...read more
Q20. What is OOP? Can main method be overloaded? What is a abstraction with example? How to take properties from base class to child class using inheritance? Why Java is not purely object oriented? What is this keyw...
read moreOOP stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects, which can contain data and code.
Main method can be overloaded in Java by defining multiple methods with the same name but different parameters.
Abstraction in OOP is the concept of hiding the implementation details and showing only the necessary features of an object. Example: Car as an object with properties like color, model, and methods like start, stop.
Inheritance in J...read more
Self-Join is when a table is joined with itself, while Cross-Join is when every row from one table is combined with every row from another table.
Self-Join is used to combine rows with other rows in the same table.
Cross-Join generates a Cartesian product of the two tables involved.
Self-Join is typically used to compare rows within the same table, like in hierarchical structures.
Cross-Join is used when there is no common key between the two tables.
Garbage collector in Java is a built-in mechanism that automatically manages memory by reclaiming unused objects.
Garbage collector runs in the background to identify and delete objects that are no longer needed.
It helps in preventing memory leaks and optimizing memory usage.
Examples of garbage collectors in Java include Serial, Parallel, CMS, and G1.
Selenium supports various navigation commands for interacting with web pages.
Some navigation commands supported by Selenium include get(), navigate().to(), navigate().back(), navigate().forward(), and navigate().refresh().
The get() command is used to open a webpage by providing the URL as a parameter.
The navigate().to() command is used to navigate to a specific URL.
The navigate().back() command is used to navigate back to the previous page in the browser history.
The navigate(...read more
To enable Actuator in a Spring Boot application, you need to include the Actuator dependency in your pom.xml file and configure it in the application.properties file.
Include Actuator dependency in pom.xml file
Configure Actuator endpoints in application.properties file
Access Actuator endpoints to monitor and manage the application
Q25. Difference between array and stack What is linked list and explain its types Advantages of each type of linked list over other Pseudo code of bubble sort algorithm Concept of deque - insertion and deletion
Array is a fixed-size collection of elements, while stack is a data structure that follows Last In First Out (LIFO) principle.
Array is a static data structure, while stack is a dynamic data structure.
In array, elements are accessed using index, while in stack, elements are accessed using push and pop operations.
Linked list is a data structure where each element points to the next element, types include singly linked list, doubly linked list, and circular linked list.
Advantage...read more
SOLID principles are a set of five design principles in object-oriented programming to make software designs more understandable, flexible, and maintainable.
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: Objects of a superclass should be replaceable with objects of its subclasses without affecting the prog...read more
Different types of waits in Selenium WebDriver include Implicit Wait, Explicit Wait, and Fluent Wait.
Implicit Wait: Waits for a certain amount of time before throwing a NoSuchElementException.
Explicit Wait: Waits for a certain condition to occur before proceeding further in the code.
Fluent Wait: Waits for a condition to be true with a specified polling frequency and timeout.
The main method in Java must include the static modifier to be able to run the program.
Without the static modifier, the main method cannot be called by the Java Virtual Machine (JVM).
The program will not be able to start and will throw a NoSuchMethodError.
Adding the static modifier allows the main method to be called without creating an instance of the class.
The four parameters needed to pass in Selenium are URL, Port Number, Browser Driver, and Desired Capabilities.
URL: The URL of the website you want to automate testing on.
Port Number: The port number where the Selenium server is running.
Browser Driver: The specific browser driver (e.g. ChromeDriver, GeckoDriver) to use for testing.
Desired Capabilities: Additional settings and preferences for the browser driver.
Assert commands in Selenium are used to verify the expected result of a test case, while verify commands are used to check for the presence of an element without halting the test execution.
Assert commands halt the test execution if the verification fails, while verify commands continue with the test execution even if the verification fails.
Assert commands are used to validate the expected result of a test case, while verify commands are used to check for the presence of an el...read more
Java Strings are immutable to ensure thread safety, security, and optimization.
Immutable strings are thread-safe as they cannot be modified concurrently by multiple threads.
Immutable strings prevent security vulnerabilities like injection attacks.
Immutable strings allow for optimization by caching and reusing string literals.
Q32. What is meant by inheritance How good are you about Spring boot and advantages of Spring boot. Spring annotations list them. List different design patterns Explain singleton design pattern Explain about collect...
read moreQuestions related to Java programming language and Spring framework
Inheritance is a mechanism in Java where a class acquires the properties of another class
Spring Boot is a popular framework for building web applications in Java
Advantages of Spring Boot include easy configuration, auto-configuration, and embedded servers
Spring annotations are used to provide metadata to the Spring framework
Some common Spring annotations include @Autowired, @Controller, and @Service
Design patt...read more
Q33. Can you provide a program that prints the second largest number in both an array and a list, illustrating implementations using streams as well as traditional methods?
Program to find second largest number in an array and list using streams and traditional methods.
Use streams to find second largest number in array: Arrays.stream(array).distinct().sorted().skip(array.length - 2).findFirst().orElse(null)
Use traditional method to find second largest number in list: Sort the list in descending order and get the element at index 1
Ensure to handle edge cases like empty array/list or arrays/lists with less than 2 elements
Q34. 1. How to improve the performance of a spring application 2. How to connect to 2 databases from spring application 3. How to develop a REST API in springboot
Improving performance, connecting to multiple databases, and developing REST API in a Spring application.
To improve performance, use caching mechanisms like Spring Cache or Redis.
To connect to 2 databases, configure multiple DataSource beans in the application context.
To develop a REST API in Spring Boot, use @RestController annotation and define request mappings.
Essential UNIX commands include ls, cd, pwd, mkdir, and rm.
ls - list directory contents
cd - change directory
pwd - print working directory
mkdir - make directory
rm - remove files or directories
ACID properties in DBMS ensure data integrity and consistency.
ACID stands for Atomicity, Consistency, Isolation, and Durability.
Atomicity ensures that all operations in a transaction are completed successfully or none at all.
Consistency ensures that the database remains in a valid state before and after the transaction.
Isolation ensures that multiple transactions can run concurrently without affecting each other.
Durability ensures that once a transaction is committed, the cha...read more
Normalization is organizing data in a database to reduce redundancy and improve data integrity. Denormalization is adding redundant data to improve read performance.
Normalization is the process of organizing data in a database to reduce redundancy and dependency by dividing the data into multiple tables and defining relationships between them.
Denormalization is the process of adding redundant data to one or more tables to improve read performance by reducing the need for join...read more
new() is used to allocate memory for an object and call its constructor, while malloc() is used to allocate memory without calling any constructor.
new() is a C++ operator, while malloc() is a function in C.
new() returns a pointer to the allocated memory, while malloc() returns a void pointer.
new() automatically calls the constructor of the object, while malloc() does not initialize the allocated memory.
Example: int* p = new int; // allocates memory for an integer and calls it...read more
In C++, a structure is a user-defined data type that can hold both data and functions, while a class can also have access specifiers and inheritance.
Structures in C++ are primarily used for grouping data members together, while classes can have additional features like access specifiers (public, private, protected) and inheritance.
Structures default to public access for their members, while classes default to private access.
Structures are typically used for simple data struct...read more
findElement() returns the first matching element on the web page, while findElements() returns a list of all matching elements.
findElement() returns a single WebElement matching the locator provided, throwing NoSuchElementException if no element is found.
findElements() returns a list of WebElements matching the locator provided, an empty list if no elements are found.
Example: WebElement element = driver.findElement(By.id("exampleId"));
Example: List<WebElement> elements = driv...read more
Use the mysqldump command to take a backup of a table in MySQL.
Use the mysqldump command followed by the database name and table name to take a backup of a specific table.
Specify the username and password for the MySQL database using the -u and -p flags.
Redirect the output of the mysqldump command to a file to save the backup.
Latency in API testing refers to the time delay between sending a request and receiving a response.
Latency can be affected by network speed, server load, and processing time.
Measuring latency helps in identifying performance bottlenecks and optimizing API performance.
Examples of tools used to measure latency in API testing include JMeter, Postman, and Gatling.
Selenium limitations include lack of support for non-web applications, difficulty in handling dynamic elements, and slow execution speed.
Limited support for non-web applications such as desktop or mobile apps
Difficulty in handling dynamic elements that change frequently
Slow execution speed compared to other automation tools
Requires a good understanding of locators and web elements to effectively automate tests
Q44. What are the new changes in UiPath and what do you like about it?
UiPath has introduced new features like AI Fabric, Document Understanding, and improved automation capabilities.
Introduction of AI Fabric for integrating AI models into automation workflows
Enhanced Document Understanding capabilities for processing unstructured data
Improved automation capabilities with features like Task Capture and Task Mining
Q45. How to remove duplicate rows in a table without using distinct?
Use a self join to remove duplicate rows in a table without using distinct.
Join the table with itself on the columns that define duplicates
Filter out rows where the primary key is the same but other columns are different
Select only distinct rows based on the primary key
Q46. Can we create more than a foreign key in single table?
Yes, it is possible to create multiple foreign keys in a single table.
Multiple foreign keys can be created in a single table by referencing different columns in the same or different tables.
Each foreign key constraint must be defined separately with appropriate references.
Foreign keys help maintain referential integrity between tables in a database.
Example: Creating foreign keys in a 'Orders' table to reference 'Customers' and 'Products' tables.
A classloader in Java is a part of the Java Runtime Environment that dynamically loads Java classes into the Java Virtual Machine.
Classloaders are responsible for loading classes during runtime based on the fully qualified name of the class.
There are different types of classloaders in Java such as Bootstrap Classloader, Extension Classloader, and System Classloader.
Classloaders follow a delegation model where a classloader delegates the class loading to its parent classloader...read more
Q48. What is the design of the microservices implemented in your current project?
The microservices in our current project are designed using a combination of RESTful APIs and event-driven architecture.
Microservices are designed to be loosely coupled and independently deployable.
Each microservice focuses on a specific business domain or functionality.
Communication between microservices is done through RESTful APIs and message queues.
We use event-driven architecture for handling asynchronous communication and data flow.
Each microservice is responsible for i...read more
Q49. What is the difference between a List and a Dictionary in programming?
List is an ordered collection of elements, while a Dictionary is a collection of key-value pairs.
List maintains elements in a specific order, while Dictionary stores key-value pairs where keys are unique.
Accessing elements in a List is done by index, while accessing values in a Dictionary is done by key.
Example: List - [1, 2, 3], Dictionary - {'a': 1, 'b': 2, 'c': 3}
The pause feature in Selenium IDE allows users to pause the execution of a test case for a specified amount of time.
The pause command is used to introduce a delay in the test execution.
It takes a parameter specifying the time to pause in milliseconds.
For example, 'pause 3000' will pause the test execution for 3 seconds.
Piping in Unix/Linux allows the output of one command to be used as the input for another command.
Piping is done using the '|' symbol
It helps in connecting multiple commands together to perform complex operations
Example: ls -l | grep 'txt' - This command lists all files in long format and then filters for files with 'txt' in their name
Q52. What would you do if the requirements keeps on changing during the course of the sprint
I would communicate with the stakeholders to understand the reasons for the changes and prioritize them accordingly.
Communicate with stakeholders to understand the reasons for the changes
Prioritize the changes based on impact and urgency
Adjust the sprint plan and tasks accordingly
Ensure clear documentation and communication with the team
Q53. What is OOP's and Explain OOP's features?
OOP stands for Object-Oriented Programming. It is a programming paradigm that uses objects to represent and manipulate data.
OOP focuses on creating reusable code through the use of classes and objects.
It emphasizes encapsulation, inheritance, and polymorphism.
Encapsulation refers to the practice of hiding the internal workings of an object from the outside world.
Inheritance allows classes to inherit properties and methods from other classes.
Polymorphism allows objects to take...read more
Q54. What is collection in java and Arrays explain?
Collection is a framework in Java that provides an architecture to store and manipulate a group of objects.
Arrays are a fixed-size collection of elements of the same data type.
Collections are dynamic and can grow or shrink in size.
Arrays use square brackets to declare and initialize, while collections use classes like ArrayList or LinkedList.
Collections provide many useful methods like add(), remove(), and size().
Packages in Java help organize and manage classes and interfaces, provide access control, and prevent naming conflicts.
Organize classes and interfaces into a single unit for better maintainability
Provide access control by using access modifiers like public, private, protected, and default
Prevent naming conflicts by using unique package names
Facilitate modular programming and code reusability
Normalization is needed in a database to reduce redundancy, improve data integrity, and optimize database performance.
Eliminates data redundancy by breaking down data into smaller, more manageable tables
Prevents update anomalies by ensuring data consistency
Improves data integrity by enforcing relationships between tables
Optimizes database performance by reducing storage space and improving query efficiency
Memory protection in operating systems is a feature that prevents a process from accessing memory that has not been allocated to it.
Memory protection helps prevent one process from interfering with the memory of another process.
It ensures that each process can only access memory that has been allocated to it.
Examples of memory protection mechanisms include read-only memory segments and memory segmentation.
Memory protection is essential for ensuring system stability and securi...read more
JIT compiler stands for Just-In-Time compiler, which compiles code during runtime for improved performance.
JIT compiler translates bytecode into machine code on-the-fly
It helps in optimizing performance by compiling frequently executed code paths
Examples include Java HotSpot VM's JIT compiler and .NET's JIT compiler
Intension refers to the attributes or properties of a concept, while extension refers to the instances or examples of that concept in a database.
Intension describes the characteristics or properties of a concept.
Extension refers to the actual instances or examples of that concept.
For example, in a database of fruits, intension would include attributes like color, taste, and size, while extension would list specific fruits like apples, oranges, and bananas.
Q60. Which is best for delete the records entity base or native query
It depends on the specific requirements and constraints of the application.
Use entity base delete for simple operations where ORM can handle cascading deletes and relationships.
Use native query for complex operations or when performance is a concern.
Consider the impact on database integrity and consistency when choosing between entity base and native query.
Q61. What is the difference between roll-up and scan component?
Roll-up and scan components are both used in data processing, but they have different functions and purposes.
Roll-up is a data aggregation technique that summarizes data at a higher level of granularity.
Scan component, on the other hand, is used to read and process data sequentially.
Roll-up is commonly used in data warehousing to generate summary reports or perform calculations on aggregated data.
Scan component is often used in data processing pipelines to iterate through lar...read more
Q62. What is different between string and StrinbBuffer ?
String is immutable while StringBuffer is mutable.
StringBuffer can be modified while String cannot.
StringBuffer is thread-safe while String is not.
StringBuffer has append() method while String does not.
StringBuffer is slower than String for simple operations.
Selenium Grid is used for parallel testing across multiple browsers, devices, and operating systems.
Use Selenium Grid when you need to run tests in parallel to save time.
It is useful for testing on multiple browsers, devices, and operating systems simultaneously.
Helps in reducing test execution time by distributing tests across multiple nodes.
Useful for large test suites that require testing on various configurations.
Can be used for continuous integration and continuous deliv...read more
Q64. What is differenet among final, finaly & finalize keyword
final is a keyword used to declare a constant variable, finally is a block used in try-catch-finally, and finalize is a method used for garbage collection.
final is used to declare a constant variable that cannot be changed
finally is a block used in try-catch-finally to execute code regardless of whether an exception is thrown or not
finalize is a method used for garbage collection to perform any necessary cleanup actions before an object is destroyed
All three keywords are unre...read more
Q65. Algo for odd - even program without using modulus operator.
Use bitwise AND operation to determine if a number is odd or even.
Use bitwise AND operation with 1 to check if the least significant bit is 1 or 0.
If the result is 1, the number is odd. If the result is 0, the number is even.
Example: num & 1 will return 1 for odd numbers and 0 for even numbers.
JUnit annotations are special markers used in JUnit tests to define the behavior of the test methods.
Annotations like @Test indicate that the method is a test method.
Annotations like @Before and @After indicate methods that should be run before and after each test method.
Annotations like @BeforeClass and @AfterClass indicate methods that should be run once before and after all test methods in a test class.
Annotations like @Ignore can be used to temporarily disable a test meth...read more
Q67. How many transitions are there in RE Framework?
There are 4 transitions in RE Framework: Init, Get Transaction Data, Process Transaction, and End Process.
Init - Initializes the application, opens applications, logs in, and sets up environment.
Get Transaction Data - Retrieves transaction data from queue or data source.
Process Transaction - Processes the transaction data, performs necessary actions, and updates status.
End Process - Cleans up resources, logs out, and closes applications.
Q68. What are the Hooks life cycle in the angular?
Hooks are functions that allow you to tap into the lifecycle of a component in Angular.
Hooks are used to perform actions at specific points in the component's lifecycle.
There are several types of hooks, including ngOnInit, ngOnChanges, and ngOnDestroy.
ngOnInit is called once when the component is initialized.
ngOnChanges is called when the component's input properties change.
ngOnDestroy is called just before the component is destroyed.
An interface in software engineering is a contract that defines the methods that a class must implement.
Defines a set of methods that a class must implement
Provides a way to achieve abstraction and multiple inheritance
Helps in achieving loose coupling between classes
Views in SQL are virtual tables that are generated based on the result set of a SELECT query.
Views are saved SELECT queries that can be treated as tables.
They can simplify complex queries by storing them as a view.
Views do not store data themselves, but display data from the underlying tables.
They can be used to restrict access to specific columns or rows of a table.
Views can be used for data abstraction and security purposes.
Q71. Difference between abstract and normal function
Abstract functions cannot be instantiated and must be implemented by child classes, while normal functions can be directly called.
Abstract functions have no implementation in the parent class, while normal functions do.
Abstract functions are declared with the 'abstract' keyword, while normal functions are not.
Normal functions can be called directly, while abstract functions must be implemented by child classes.
An example of an abstract function is 'draw' in a 'Shape' class, w...read more
Dependency injection is a design pattern in which components are given their dependencies rather than creating them internally.
Allows for easier testing by providing mock dependencies
Promotes loose coupling between components
Improves code reusability and maintainability
Examples: Constructor injection, Setter injection, Interface injection
Q73. Concurrent HashMap vs HashMap. When to use which one.
ConcurrentHashMap is thread-safe and allows concurrent access, while HashMap is not thread-safe and can lead to race conditions.
Use ConcurrentHashMap when multiple threads need to access and modify the map concurrently.
Use HashMap when only a single thread will be accessing or modifying the map.
ConcurrentHashMap is more suitable for high-concurrency scenarios like multi-threaded applications.
HashMap is faster for single-threaded operations due to lack of synchronization overh...read more
Q74. Create forms in Drupal with explanation with all line of code
Creating forms in Drupal with code explanation
Use the Drupal Form API to create forms
Define form elements using the Form API functions
Implement form validation and submission handlers
Use hook_form_alter to modify existing forms
Q75. How will you deal with difficult customer
I will listen to their concerns, empathize with their situation, and work towards finding a solution that meets their needs.
Listen actively to understand their concerns
Empathize with their situation to show understanding and build rapport
Work collaboratively to find a solution that meets their needs
Maintain professionalism and patience throughout the interaction
Q76. How do you provide security for restful webservices
Security for RESTful webservices is provided through authentication, authorization, encryption, and input validation.
Implement authentication mechanisms such as OAuth, JWT, or API keys to verify the identity of clients accessing the services.
Use authorization techniques like role-based access control (RBAC) or attribute-based access control (ABAC) to control what actions users can perform.
Encrypt sensitive data using SSL/TLS to ensure secure communication between clients and ...read more
Q77. from an array you have find the 2nd largest number using java 8
Use Java 8 stream to find the 2nd largest number in an array of strings.
Convert the array of strings to an array of integers using stream and map function.
Sort the array in descending order using sorted() method.
Skip the first element to get the second largest number using skip() method.
Q78. diff between abstract class and interfaces
Abstract classes can have implementation while interfaces cannot.
Abstract classes can have constructors while interfaces cannot.
A class can implement multiple interfaces but can only inherit from one abstract class.
Abstract classes can have non-abstract methods while interfaces can only have abstract methods.
Interfaces are used for full abstraction while abstract classes are used for partial abstraction.
Example of abstract class: public abstract class Animal { public void eat...read more
Q79. Give me example for list comprehension and regression
List comprehension is a concise way to create lists in Python. Regression is a statistical method to model relationships between variables.
List comprehension example: squares = [x**2 for x in range(10)]
Regression example: fitting a linear regression model to predict house prices based on square footage
Q80. Tell about Data Structures in C++
Data structures in C++ are used to organize and store data efficiently.
C++ provides various built-in data structures like arrays, linked lists, stacks, queues, trees, and graphs.
These data structures can be used to store and manipulate data in an efficient manner.
C++ also allows for the creation of user-defined data structures using classes and structures.
The choice of data structure depends on the type of data and the operations that need to be performed on it.
Q81. What is the difference btw c and c++?
C is a procedural programming language while C++ is an object-oriented programming language.
C is a procedural programming language, while C++ is a multi-paradigm language that supports procedural, object-oriented, and generic programming.
C does not support classes and objects, while C++ does.
C does not have built-in support for exception handling, while C++ does with try-catch blocks.
C does not have namespaces, while C++ does to avoid naming conflicts.
C does not have function...read more
JIT compiler stands for Just-In-Time compiler, which compiles code during runtime instead of ahead of time.
JIT compiler converts bytecode into machine code on-the-fly
Improves performance by optimizing frequently executed code
Examples include Java HotSpot, .NET CLR
Q83. What is SDLC in software engineering
SDLC stands for Software Development Life Cycle, a process used by software engineers to design, develop, and test software applications.
SDLC is a structured process that consists of several phases including planning, analysis, design, implementation, testing, and maintenance.
Each phase of SDLC has its own set of activities and deliverables to ensure the successful completion of the software project.
Examples of SDLC models include Waterfall, Agile, and DevOps, each with its o...read more
Q84. How to make class as Immutable?
To make a class immutable, its state should not be modifiable after creation.
Make all fields private and final
Do not provide any setters
If mutable objects are used, return copies instead of references
Ensure that the class cannot be extended
Consider making the constructor private and providing a factory method
Q85. What are the decorators in python
Decorators in Python are functions that modify the behavior of other functions or methods.
Decorators are denoted by the @ symbol followed by the decorator function name.
They are commonly used for adding functionality to existing functions without modifying their code.
Decorators can be used for logging, authentication, caching, and more.
Example: @staticmethod decorator in Python is used to define a method that is not bound to a class instance.
Q86. What is abstract function
An abstract function is a function that has no implementation and must be implemented by its subclasses.
An abstract function is declared with the 'abstract' keyword.
It is used to define a template for its subclasses to follow.
It cannot be instantiated and must be implemented by its subclasses.
It can have abstract and non-abstract methods.
Example: abstract class Animal { abstract void makeSound(); }
Example: class Dog extends Animal { void makeSound() { System.out.println('Bark...read more
Q87. what are the oops concept in java.
Object-oriented programming concepts in Java include 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 of an object.
Q88. Explain the impediments that you resolved
Resolved impediments related to outdated technology, lack of communication, and unclear requirements
Upgraded legacy systems to modern technology to improve performance and security
Implemented regular team meetings to enhance communication and collaboration
Worked closely with stakeholders to clarify project requirements and ensure alignment
Q89. Write a program to print characters in the string?
Program to print characters in a string
Use a loop to iterate through each character in the string
Print each character as you iterate through the string
Q90. Explain concepts of Docker and Kubernetes
Docker is a platform for developing, shipping, and running applications in containers. Kubernetes is a container orchestration tool for managing containerized applications across a cluster of nodes.
Docker allows developers to package applications and dependencies into containers for easy deployment.
Kubernetes automates the deployment, scaling, and management of containerized applications.
Docker containers are lightweight, portable, and isolated environments that can run on an...read more
Q91. Talk for 3 min in any topic of your interest
Discussing the impact of artificial intelligence on society
Introduction to artificial intelligence and its applications
Benefits of AI in various industries such as healthcare, finance, and transportation
Ethical considerations and concerns surrounding AI technology
Future implications of AI on the job market and economy
Q92. What are your preffered location?
I prefer locations with a good work-life balance, access to outdoor activities, and a vibrant tech community.
Good work-life balance is important to me
Access to outdoor activities like hiking and biking
Vibrant tech community for networking and growth opportunities
XPath is a query language used for selecting nodes from an XML document.
XPath stands for XML Path Language
It is used to navigate through elements and attributes in an XML document
XPath uses path expressions to select nodes or content in an XML document
Example: //book[@category='fiction'] selects all book elements with category attribute equal to 'fiction'
Q94. Difference between Union and Union All in Sql
Union combines and removes duplicates, Union All combines without removing duplicates.
Union merges the result sets of two or more SELECT statements and removes duplicates
Union All merges the result sets of two or more SELECT statements without removing duplicates
Union is slower than Union All as it involves removing duplicates
Example: SELECT column1 FROM table1 UNION SELECT column1 FROM table2;
Example: SELECT column1 FROM table1 UNION ALL SELECT column1 FROM table2;
Q95. Difference between list and tuple in python
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.
Example: list_example = [1, 2, 3], tuple_example = (4, 5, 6)
Q96. What do you know about Capg?
Capgemini is a global leader in consulting, technology services and digital transformation.
Capgemini is a multinational corporation headquartered in France.
It provides consulting, technology services, and digital transformation.
Capgemini operates in over 40 countries and has around 200,000 employees worldwide.
Q97. What is Enhanced RE Framework?
Enhanced RE Framework is a robust automation framework in UiPath that provides reusable components and efficient error handling.
Enhanced RE Framework is an advanced version of the Robotic Enterprise Framework (REFramework) in UiPath.
It includes additional features such as enhanced error handling, logging, and reusability of components.
The framework follows best practices for automation development and helps in building scalable and maintainable automation solutions.
It consist...read more
Q98. What is functional interface?
Functional interface is an interface with only one abstract method.
Functional interface can have any number of default or static methods.
It is used in lambda expressions and method references.
Examples of functional interfaces are Runnable, Comparator, and Predicate.
Q99. what is different security majors
Different security majors focus on various aspects of cybersecurity such as network security, application security, and cloud security.
Network Security: Focuses on securing networks and preventing unauthorized access.
Application Security: Involves securing software applications from threats and vulnerabilities.
Cloud Security: Concentrates on protecting data stored in cloud environments.
Information Security: Encompasses all aspects of securing information and data.
Cybersecurit...read more
Q100. Goroutines - explain with example code
Goroutines are lightweight threads managed by Go runtime, allowing concurrent execution of functions.
Goroutines are created using the 'go' keyword followed by a function call.
They are multiplexed onto multiple OS threads by the Go runtime.
Example: go func() { fmt.Println('Hello, goroutine!') }
Goroutines are used for concurrent programming in Go, enabling parallelism.
More about working at Capgemini







Top HR Questions asked in Capgemini Senior Software Engineer
Interview Process at Capgemini Senior Software Engineer

Top Senior Software Engineer Interview Questions from Similar Companies





