
Mphasis


60+ Mphasis Senior Software Engineer Interview Questions and Answers
Q1. Trapping Rain Water Problem Statement
Given a long type array/list ARR
of size N
, representing an elevation map where ARR[i]
denotes the elevation of the ith
bar, calculate the total amount of rainwater that ca...read more
Calculate the total amount of rainwater that can be trapped in given elevation map.
Iterate through the array to find the maximum height on the left and right of each bar.
Calculate the amount of water that can be trapped above each bar by taking the minimum of the maximum heights on the left and right.
Sum up the trapped water above each bar to get the total trapped water for the entire elevation map.
Index hunting helps improve query performance by reducing the number of rows that need to be scanned.
Indexes allow the database to quickly locate the rows that satisfy a query criteria.
By using indexes, the database can avoid scanning the entire table, leading to faster query execution.
Examples of indexes include primary keys, unique keys, and indexes on frequently queried columns.
Different types of locators in Selenium include ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, XPath, and CSS Selector.
ID - Locate elements by their ID attribute
Name - Locate elements by their Name attribute
Class Name - Locate elements by their Class attribute
Tag Name - Locate elements by their HTML tag name
Link Text - Locate anchor elements by their exact text
Partial Link Text - Locate anchor elements by partial text
XPath - Locate elements using XML Path expre...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 func...read more
PermGen is a fixed size memory space for JVM metadata in Java 7 and earlier, while MetaSpace is a memory space that dynamically resizes in Java 8+.
PermGen is used for storing class metadata, interned strings, and constant pool data.
MetaSpace is used for storing class metadata, method data, and JIT code.
PermGen has a fixed size and can lead to OutOfMemoryError if exceeded.
MetaSpace dynamically resizes based on application demand and can be limited by the operating system.
PermG...read more
The @SpringBootApplication annotation is used to mark the main class of a Spring Boot application.
Combines @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations
Enables Spring Boot to automatically configure the application based on dependencies and classpath
Marks the entry point of the Spring Boot application
The starter dependency of the Spring Boot module is spring-boot-starter.
The starter dependency provides a set of common dependencies for a specific type of application, making it easier to get started with Spring Boot.
For example, spring-boot-starter-web includes dependencies for building web applications using Spring MVC.
Other common starter dependencies include spring-boot-starter-data-jpa for JPA data access and spring-boot-starter-test for testing.
@ComponentScan is used to automatically detect and register Spring components in the classpath.
Scans the specified package and its sub-packages for classes annotated with @Component, @Repository, @Service, or @Controller
Registers the detected classes as Spring beans for dependency injection and other Spring features
Reduces the need for manual bean configuration in the Spring application context
Can be customized with basePackageClasses, basePackages, includeFilters, and exclud...read more
Java Virtual Machine (JVM) is a virtual machine that enables a computer to run Java programs.
JVM is responsible for converting Java bytecode into machine code that can be executed by the computer's processor.
It provides a layer of abstraction between the Java code and the underlying hardware and operating system.
JVM manages memory, handles garbage collection, and provides security features for Java applications.
Examples of JVM implementations include Oracle HotSpot, OpenJ9, a...read more
Q10. 4.When you are assigned task in beginning of the sprint what steps do you perform to take it further till completion.
To complete a task assigned at the beginning of a sprint, I follow a set of steps.
I analyze the requirements and scope of the task.
I break down the task into smaller sub-tasks and estimate the time required for each sub-task.
I prioritize the sub-tasks based on their importance and dependencies.
I create a plan and timeline for completing the sub-tasks.
I communicate with the team and stakeholders to ensure everyone is on the same page.
I start working on the sub-tasks and track ...read more
Four necessary and sufficient conditions for deadlock
Mutual exclusion: Resources cannot be shared between processes. Example: Process A holding Resource 1 and waiting for Resource 2, while Process B holding Resource 2 and waiting for Resource 1.
Hold and wait: Processes hold resources while waiting for others. Example: Process A holding Resource 1 and waiting for Resource 2, while Process B holding Resource 2 and waiting for Resource 3.
No preemption: Resources cannot be forcib...read more
The default port of Tomcat in Spring Boot is 8080.
The default port can be changed in the application.properties file by setting server.port property.
To run the Spring Boot application on a different port, you can specify the port number as a command line argument.
For example, to run the application on port 9090, you can use the command: java -jar -Dserver.port=9090 myapp.jar
Bootstrap program is the initial code that runs when a computer is powered on, loading the operating system into memory.
Bootstrap program is stored in ROM or firmware.
It initializes the system hardware and loads the operating system kernel into memory.
Examples include BIOS in PCs and UEFI in modern systems.
Microservices design is characterized by modularity, independence, scalability, and resilience.
Modularity: Microservices are designed as independent modules that can be developed, deployed, and scaled separately.
Independence: Each microservice operates independently and communicates with other services through APIs.
Scalability: Microservices allow for scaling specific components of an application based on demand.
Resilience: Microservices are designed to be fault-tolerant, wit...read more
Different strategies for deploying microservices include blue-green deployment, canary deployment, rolling deployment, and feature flagging.
Blue-green deployment involves running two identical production environments, with one serving as the active environment while the other is on standby. Traffic is switched from one environment to the other once the new version is deemed stable.
Canary deployment gradually rolls out a new version to a small subset of users before making it ...read more
The super keyword is used to refer to the parent class in Java.
Used to call the constructor of the parent class in the child class.
Used to access the parent class methods and variables.
Helps in achieving method overriding in inheritance.
Q17. How you will fix memory overhead issues in production?
Memory overhead issues can be fixed by optimizing code, reducing unnecessary data, and using efficient data structures.
Analyze code to identify memory leaks and optimize it
Reduce unnecessary data by removing unused variables and objects
Use efficient data structures like arrays instead of linked lists
Implement caching to reduce memory usage
Use garbage collection to free up memory
Consider using a memory profiler to identify memory usage patterns
Ensure proper memory allocation a...read more
Q18. How to handle customized exceptions in controller advice with example code.
Handling customized exceptions in controller advice with example code
Create a custom exception class that extends RuntimeException
Create a controller advice class to handle exceptions globally
Use @ExceptionHandler annotation in the controller advice class to handle specific exceptions
Return a custom error response with appropriate status code and message
Data Warehousing is the process of collecting, storing, and managing data from various sources for analysis and reporting.
Data Warehousing involves extracting data from multiple sources
Data is then transformed and loaded into a central repository
The data can be queried and analyzed for business intelligence purposes
Examples include using a data warehouse to analyze sales trends or customer behavior
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 prevent memory leaks and optimize memory usage.
Examples of garbage collectors in Java include Serial, Parallel, CMS, and G1.
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 segmentation and paging.
Segmentation divides memory into segments and assigns access rights to each segment.
Paging divide...read more
Normalization is needed in a database to reduce data redundancy, improve data integrity, and optimize database performance.
Eliminates data redundancy by breaking down data into smaller tables
Reduces update anomalies and inconsistencies in data
Improves data integrity by enforcing relationships between tables
Optimizes database performance by reducing storage space and improving query efficiency
Profiles in Spring Boot allow for different configurations to be applied based on the environment or specific needs.
Profiles can be used to define different sets of configurations for different environments such as development, testing, and production.
By using profiles, you can easily switch between configurations without changing the code.
Profiles are typically defined in application.properties or application.yml files using the 'spring.profiles.active' property.
You can also...read more
Access specifiers in Java control the visibility of classes, methods, and variables.
There are four access specifiers in Java: public, protected, default (no specifier), and private.
Public: accessible from any other class.
Protected: accessible within the same package or subclasses.
Default: accessible only within the same package.
Private: accessible only within the same class.
Q25. What is Angular component life cycle? What are the hooks provided by Angular framework?
Angular component life cycle includes various hooks provided by Angular framework for managing component initialization, change detection, and destruction.
ngOnChanges: Called when input properties of a component change
ngOnInit: Called once when the component is initialized
ngDoCheck: Called during every change detection run
ngAfterContentInit: Called after content (ng-content) has been projected into the component
ngAfterContentChecked: Called after every check of the projected ...read more
Q26. What is box model in CSS? How to create responsive websites and web applications?
The box model in CSS defines the design and layout of elements on a webpage.
The box model consists of content, padding, border, and margin.
Content is the actual content of the element, padding is the space between the content and the border, border is the border around the element, and margin is the space outside the border.
To create responsive websites and web applications, use media queries to adjust styles based on screen size, use flexible units like percentages or ems, a...read more
Q27. How to handle the exceptions globally in rest api Springboot
Handle exceptions globally in Springboot REST API
Use @ControllerAdvice annotation to define global exception handling for all controllers
Create a class annotated with @ControllerAdvice and define methods to handle specific exceptions
Use @ExceptionHandler annotation to specify which exceptions the method should handle
Return appropriate HTTP status codes and error messages in the exception handling methods
Q28. What annotations are included in @SpringbootApplication annotation
The @SpringBootApplication annotation includes @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations.
Includes @Configuration annotation to specify that the class can be used by the Spring IoC container as a source of bean definitions.
Includes @EnableAutoConfiguration annotation to enable Spring Boot's auto-configuration feature.
Includes @ComponentScan annotation to specify the base packages to scan for components.
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 at 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 Application Classloader.
Classloaders follow a delegation model where a classloader delegates the class loading to its parent classloade...read more
Q30. What is the Data Structure ?
Data structure is a way of organizing and storing data in a computer so that it can be accessed and modified efficiently.
Data structures define the way data is organized and stored in memory.
Examples include arrays, linked lists, stacks, queues, trees, and graphs.
Choosing the right data structure is crucial for efficient algorithm design and performance.
Q31. Find names starting with "A" and department 2 from a list and add values into another list using java 8.
Using Java 8, filter names starting with 'A' and in department 2 and add them to a new list.
Use Java 8 stream to filter names starting with 'A' and in department 2
Collect the filtered names into a new list
Q32. What is oops , what is java, what is jdbc what is packages what is
OOPs is Object-Oriented Programming, Java is a programming language, JDBC is Java Database Connectivity, packages are used to organize classes and interfaces.
OOPs is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
JDBC is a Java API that allows Jav...read more
JIT compiler stands for Just-In-Time compiler, which compiles code during runtime instead of ahead of time.
JIT compiler translates bytecode into machine code on-the-fly
Improves performance by optimizing frequently executed code
Examples include Java HotSpot, .NET CLR, V8 JavaScript engine
Dependency injection is a design pattern where components are provided with 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
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
Helps achieve abstraction and loose coupling
Allows for multiple classes to implement the same interface
Example: Java interfaces define method signatures that classes must implement
Q36. how to convert rows to columns
To convert rows to columns, use the PIVOT function in SQL or transpose function in Excel.
Identify the column to be transposed as the new row header
Identify the column to be used as the new column header
Use PIVOT function in SQL or transpose function in Excel
Example: SELECT * FROM table_name PIVOT (MAX(column_to_be_transposed) FOR column_to_be_used AS new_column_header)
Example: Select the data to be transposed in Excel, copy it, select a new cell, right-click and select 'Trans...read more
Q37. Write java program to count the number of repeated characters in the string
Java program to count the number of repeated characters in a string
Create a HashMap to store characters and their counts
Iterate through the string and update the counts in the HashMap
Print the characters with counts greater than 1
Java 8 streams are a sequence of elements that support functional-style operations.
Streams allow for processing collections of data in a declarative way.
They can be used to perform operations like filter, map, reduce, and collect.
Streams are lazy, meaning they only perform operations when necessary.
Example: List<String> names = Arrays.asList("Alice", "Bob", "Charlie"); Stream<String> stream = names.stream();
Q39. 5.Can you do debugging while performing testing
Yes, debugging is an integral part of testing.
Debugging helps identify and fix issues in the code.
Debugging can be done using tools like breakpoints, logs, and debuggers.
Debugging should be done in a separate environment to avoid affecting the testing environment.
Debugging should be done in a systematic manner to ensure all issues are identified and resolved.
Q40. what is Authentication, how to achieve it
Authentication is the process of verifying the identity of a user or system.
Authentication involves confirming the identity of a user through credentials such as passwords, biometrics, or security tokens.
Common methods of authentication include single-factor authentication (e.g. password) and multi-factor authentication (e.g. password + SMS code).
Authentication can be achieved through protocols like OAuth, OpenID, SAML, and JWT.
Implementing secure authentication practices is ...read more
Q41. Concurrent modification exception.how to avoid it
To avoid concurrent modification exception, use synchronized blocks or data structures like ConcurrentHashMap.
Use synchronized blocks to ensure only one thread can modify the data at a time
Use data structures like ConcurrentHashMap which are designed to handle concurrent modifications
Consider using immutable objects to prevent modification conflicts
Views in SQL are virtual tables that are generated based on the result set of a SELECT query.
Views are not stored physically in the database, but are dynamically generated when queried.
They can be used to simplify complex queries by encapsulating logic and joining multiple tables.
Views can also be used to restrict access to certain columns or rows of a table.
Example: CREATE VIEW vw_employee AS SELECT emp_id, emp_name FROM employees;
Q43. Micro services design pattern and example
Microservices design pattern involves breaking down a large application into smaller, independent services.
Each microservice is responsible for a specific function or feature
Communication between microservices is typically done through APIs
Microservices can be deployed independently, allowing for easier scalability and maintenance
Examples include Netflix (uses microservices for different functionalities like recommendation, user management) and Amazon (uses microservices for ...read more
Q44. Explain commands related to file management
File management commands are used to interact with files and directories on a computer system.
ls - list files and directories in the current directory
cd - change directory
mkdir - create a new directory
rm - remove files or directories
cp - copy files or directories
mv - move files or directories
touch - create a new file
chmod - change file permissions
Q45. Explain commands related to process management
Commands related to process management include ps, top, kill, and nice.
ps - displays information about currently running processes
top - provides a dynamic real-time view of a running system
kill - terminates a process by sending a signal to its PID
nice - sets the priority of a process
Q46. Rate your skills in SQL, Informatica
I rate my SQL skills as advanced and my Informatica skills as intermediate.
Advanced SQL skills include complex queries, stored procedures, and performance tuning.
Intermediate Informatica skills include ETL development, mapping design, and workflow scheduling.
I have experience with both SQL Server and Oracle databases.
I am constantly learning and improving my skills in both areas.
Q47. How do you manage your Servers
I manage servers using automation tools like Ansible and monitoring tools like Nagios.
Utilize automation tools like Ansible to provision and configure servers
Implement monitoring tools like Nagios to track server performance and uptime
Regularly update software and security patches to ensure server stability
Implement backup and disaster recovery plans to prevent data loss
Utilize cloud services like AWS or Azure for scalability and flexibility
Q48. deep analysis of the coding
The question requires a detailed analysis of a piece of code.
Examine the code line by line to understand its functionality
Identify any potential bugs or inefficiencies in the code
Consider the overall design and structure of the code
Look for opportunities to optimize or refactor the code
Test different inputs to understand the code's behavior
Q49. Map, flatmap method difference in stream
Map method transforms each element in a stream, while flatMap method transforms each element into a stream and then flattens the result.
Map method applies a function to each element in the stream and returns a new stream with the transformed elements.
FlatMap method applies a function that returns a stream for each element in the original stream, then flattens these streams into a single stream.
Example: Using map to convert a list of strings to uppercase - List
names = Arrays....read more
Q50. Explain BDD framework
BDD is a software development approach that focuses on collaboration between developers, testers, and business stakeholders.
BDD stands for Behavior Driven Development
It emphasizes on defining the behavior of the system from the user's perspective
It uses natural language to describe the behavior of the system in terms of scenarios and steps
It involves collaboration between developers, testers, and business stakeholders to ensure that the system meets the requirements
Tools like...read more
Q51. Hive & Spark optimization techniques
Hive & Spark optimization techniques
Use partitioning and bucketing in Hive to reduce data scanning
Use broadcast join and shuffle partitioning in Spark to optimize performance
Use caching and persisting in Spark to reuse data in memory
Use dynamic allocation and executor memory management in Spark to optimize resource utilization
Q52. Write feature file for login page
Feature file for login page
Create a feature file named 'login.feature'
Define a scenario for successful login
Define a scenario for unsuccessful login
Include steps like entering username, password, clicking login button
Use Given-When-Then format for scenarios
Q53. what is a interceptor
An interceptor is a design pattern commonly used in software development to capture and manipulate requests and responses.
Interceptors can be used for logging, authentication, authorization, caching, error handling, etc.
In Angular, interceptors can be used to modify HTTP requests before they are sent and responses before they are received.
In Spring framework, interceptors can be used to intercept client requests and server responses in a web application.
Q54. Explain Linux architecture?
Linux architecture is a layered system with kernel at the core, followed by system libraries, utilities, and user interface.
Linux architecture consists of the kernel, which is the core component responsible for managing hardware resources and providing essential services.
Above the kernel are system libraries, which provide additional functionalities to applications and help in interacting with the kernel.
Utilities in Linux include command-line tools and graphical interfaces t...read more
Q55. Explain Delegates , async/ await
Delegates are type-safe function pointers in C# used for implementing callbacks. async/await is used for asynchronous programming in C#.
Delegates in C# are similar to function pointers in C or C++. They allow methods to be passed as parameters to other methods.
Async/await in C# is used for asynchronous programming, allowing methods to run asynchronously without blocking the main thread.
Delegates can be used with async/await to define asynchronous callback methods.
Q56. Attributes of transactional annotation
Transactional annotation in software engineering is used to manage database transactions.
Transactional annotation ensures that a group of operations are treated as a single unit of work.
It helps in maintaining data integrity by either committing all changes or rolling back if an error occurs.
Examples include @Transactional in Spring framework and @Transaction in Java EE.
Q57. Explain cucumber architecture
Cucumber architecture is a testing framework that supports Behavior Driven Development (BDD) by allowing tests to be written in plain language.
Cucumber uses Gherkin syntax to define test cases in a human-readable format
It separates the test logic from the test data using feature files and step definitions
Cucumber integrates with various programming languages like Java, Ruby, and JavaScript
It allows collaboration between non-technical stakeholders and developers through the us...read more
Q58. Explain some Design patterns
Design patterns are reusable solutions to common problems in software design.
Design patterns help in creating flexible, maintainable, and scalable software.
Some common design patterns include Singleton, Factory, Observer, Strategy, and Decorator.
Singleton pattern ensures a class has only one instance and provides a global point of access to it.
Factory pattern creates objects without specifying the exact class of object that will be created.
Observer pattern defines a one-to-ma...read more
Q59. Coding qu using stream api
Using stream API for coding questions
Use stream() method to convert a collection into a Stream
Use filter() method to filter elements based on a condition
Use map() method to transform elements into another form
Use collect() method to collect the elements into a new collection
Q60. What is jit compiler
JIT compiler stands for Just-In-Time compiler, which compiles code during runtime instead of ahead of time.
JIT compiler translates bytecode into machine code on the fly
Improves performance by optimizing frequently executed code segments
Examples include Java HotSpot, .NET CLR's JIT compiler
Q61. Abstract class vs interface
Abstract class is a class that cannot be instantiated and can have both abstract and non-abstract methods. Interface is a contract that a class must adhere to.
Abstract class can have instance variables, constructors, and non-abstract methods.
Interface can only have constants and abstract methods.
A class can implement multiple interfaces but can only extend one abstract class.
Abstract class provides a common base for related classes, while interface defines a common behavior f...read more
Q62. Microservice design pattern
Microservice design pattern focuses on breaking down a large application into smaller, independent services.
Each microservice is responsible for a specific function or feature
Communication between microservices is typically done through APIs
Microservices can be deployed independently, allowing for scalability and flexibility
Q63. Explain encapsulation
Encapsulation is the concept of bundling data and methods that operate on the data into a single unit.
Encapsulation helps in hiding the internal state of an object and restricting access to it.
It allows for data hiding, which prevents outside code from directly accessing an object's internal state.
Encapsulation also helps in achieving data abstraction, where the internal details of an object are hidden and only the necessary details are exposed.
By using access modifiers like ...read more
Q64. Define. Net core?
ASP.NET Core is a cross-platform, high-performance framework for building modern, cloud-based, internet-connected applications.
Cross-platform framework for building web applications
High-performance and scalable
Supports cloud-based and internet-connected applications
Q65. Explain web api?
Web API is a set of rules and protocols that allow different software applications to communicate with each other over the internet.
Web API stands for Application Programming Interface for web-based systems.
It allows different software applications to interact with each other over the internet.
Web APIs use HTTP protocols to enable communication between systems.
Examples of web APIs include RESTful APIs, SOAP APIs, and GraphQL APIs.
Q66. Explain java jvm
Java JVM stands for Java Virtual Machine, which is a virtual machine that enables a computer to run Java programs.
Java JVM is a virtual machine that interprets Java bytecode and executes it on the underlying hardware.
It provides platform independence by abstracting the hardware and operating system details.
JVM manages memory, garbage collection, and runtime environment for Java programs.
Examples of JVM implementations include Oracle HotSpot, OpenJ9, and GraalVM.
Top HR Questions asked in Mphasis Senior Software Engineer
Interview Process at Mphasis Senior Software Engineer

Top Senior Software Engineer Interview Questions from Similar Companies








Reviews
Interviews
Salaries
Users/Month

