Capita
30+ Bajaj Finance Interview Questions and Answers
Q1. Palindrome String Validation
Determine if a given string 'S' is a palindrome, considering only alphanumeric characters and ignoring spaces and symbols.
Note:
The string 'S' should be evaluated in a case-insensi...read more
Check if a given string is a palindrome after removing special characters, spaces, and converting to lowercase.
Remove special characters and spaces from the input string
Convert the string to lowercase
Check if the modified string is a palindrome by comparing characters from start and end
Q2. Reverse Stack with Recursion
Reverse a given stack of integers using recursion. You must accomplish this without utilizing extra space beyond the internal stack space used by recursion. Additionally, you must r...read more
Reverse a given stack of integers using recursion without using extra space or loop constructs.
Use recursion to pop all elements from the original stack and store them in function call stack.
Once the stack is empty, push the elements back in reverse order using recursion.
Make use of the top(), pop(), and push() stack methods provided.
JVM allocates 5 types of memory areas: Method Area, Heap, Stack, PC Register, and Native Method Stack.
Method Area stores class structures and static variables.
Heap is where objects are allocated.
Stack holds method-specific data and references.
PC Register stores the address of the current instruction being executed.
Native Method Stack is used for native method execution.
Q4. How to display values fetch from a table with alternate value
Display values from a table with alternate value
Use a loop to iterate through the table values
Use an if-else statement to check for alternate values
Display the alternate values using a different formatting or color
Consider using CSS or JavaScript to enhance the display
Optional class in Java provides a way to handle null values more effectively.
Prevents NullPointerException by explicitly checking for null values
Encourages developers to handle null values properly
Provides methods like isPresent(), ifPresent(), orElse() for better null value handling
Improves code readability and maintainability
Example: Optional<String> optionalString = Optional.ofNullable(str);
The @RequestMapping annotation is used to map web requests to specific handler methods, while @RestController is used to define RESTful web services.
The @RequestMapping annotation is used to map HTTP requests to specific handler methods in a controller class.
It can be used to specify the URL path, HTTP method, request parameters, headers, and media types for the mapping.
Example: @RequestMapping(value = "/hello", method = RequestMethod.GET)
The @RestController annotation is use...read more
To find the number of rows and eliminate duplicate values in a DB2 table, you can use SQL queries.
Use the COUNT function to find the number of rows in the table.
To eliminate duplicate values, use the DISTINCT keyword in your SELECT query.
You can also use the GROUP BY clause to group rows with the same values and then use aggregate functions like COUNT to find the number of unique rows.
Major differences between @RequestMapping and @GetMapping in Spring Boot
1. @RequestMapping can be used for all HTTP methods, while @GetMapping is specific to GET requests.
2. @RequestMapping allows for more customization with parameters like method, headers, and produces/consumes, while @GetMapping is more concise.
3. @GetMapping is a specialized version of @RequestMapping with method set to GET by default.
4. Example: @RequestMapping(value = "/example", method = RequestMethod.P...read more
Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.
Abstract class can have constructors, fields, and methods, while interface cannot have any implementation.
A class can only extend one abstract class, but can implement multiple interfaces.
Abstract classes are used to define common characteristics among subclasses, while interfaces are used to define a contract for classes to implement.
Example: Abstract class 'Shape' ...read more
The @Transactional annotation in Spring JPA is used to manage transactions in database operations.
Ensures that a method is executed within a transaction context
Rolls back the transaction if an exception is thrown
Controls the transaction boundaries
setMaxResults() limits the number of results returned by a query, while setFetchSize() sets the number of rows to fetch in each round trip to the database.
setMaxResults() is used to limit the number of results returned by a query.
setFetchSize() sets the number of rows to fetch in each round trip to the database.
setMaxResults() is typically used for pagination purposes.
setFetchSize() can improve performance by reducing the number of round trips to the database.
Example: setMaxR...read more
Session interface in Hibernate is used to create, read, update, and delete persistent objects.
Session interface is used to interact with the database in Hibernate.
It represents a single-threaded unit of work.
It is lightweight and designed to be instantiated each time an interaction with the database is needed.
Session interface provides methods like save, update, delete, get, load, etc.
Example: Session session = sessionFactory.openSession();
CURSOR in COBOL is used to navigate through a result set in a database program.
Declare a CURSOR in the Working-Storage section of the COBOL program
Open the CURSOR to fetch data from the database
Use FETCH statement to retrieve rows from the result set
Process the fetched data as needed
Close the CURSOR when done with the result set
Q14. Where did u implemented oops concepts in your project? Stream api, Map in Collections
Yes
Implemented OOPs concepts in the project using Stream API
Utilized Map in Collections to implement OOPs principles
Used Stream API to apply functional programming concepts in the project
Q15. Write controller to serve POST request for a rest call in spring
A controller to handle POST requests in a Spring REST API.
Create a new class annotated with @RestController
Define a method in the class annotated with @PostMapping
Use @RequestBody annotation to bind the request body to a parameter
Implement the logic to handle the POST request
Return the response using ResponseEntity
Q16. How to remove low values while fetching data from table in DB2
Use SQL query with WHERE clause to filter out low values while fetching data from DB2 table
Use SELECT statement to fetch data from table
Add WHERE clause with condition to filter out low values
Example: SELECT * FROM table_name WHERE column_name > 10
Use ORDER BY clause to sort the data in ascending or descending order
Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity. Denormalization is the opposite process.
Normalization involves breaking down a table into smaller tables and defining relationships between them to reduce redundancy.
Denormalization involves combining tables to reduce the number of joins needed for queries, sacrificing some normalization benefits for performance.
Normalization helps in maintaining data integrity and c...read more
Standard Java pre-defined functional interfaces include Function, Consumer, Predicate, Supplier, etc.
Function: Represents a function that accepts one argument and produces a result. Example: Function<Integer, String>
Consumer: Represents an operation that accepts a single input argument and returns no result. Example: Consumer<String>
Predicate: Represents a predicate (boolean-valued function) of one argument. Example: Predicate<Integer>
Supplier: Represents a supplier of result...read more
Spring Actuator is a set of production-ready features to help monitor and manage your application.
Provides insight into application's health, metrics, and other useful information
Enables monitoring and managing of application in real-time
Helps in identifying and troubleshooting issues quickly
Can be easily integrated with other monitoring tools like Prometheus or Grafana
Hibernate provides several concurrency strategies like optimistic locking, pessimistic locking, and versioning.
Optimistic locking: Allows multiple transactions to read a row simultaneously, but only one can update it. Uses versioning or timestamp to check for conflicts.
Pessimistic locking: Locks the row for exclusive use by one transaction, preventing other transactions from accessing it until the lock is released.
Versioning: Uses a version number or timestamp to track change...read more
Lambda expressions are anonymous functions that can be passed as arguments to methods or stored in variables.
Lambda expressions are written using the -> operator.
They can have zero or more parameters.
They can have zero or more statements.
They can be used to implement functional interfaces in Java.
Example: (a, b) -> a + b
Q22. Annotations used in web services, pagination, exception handling in spring
Annotations used in web services, pagination, exception handling in Spring
Web services in Spring can be annotated with @RestController or @Controller
Pagination can be achieved using @PageableDefault and @PageableParam
Exception handling can be done using @ExceptionHandler and @ControllerAdvice
The super keyword is used to refer to the parent class of a subclass.
Used to call methods or access fields from the parent class
Helps in achieving method overriding in inheritance
Can be used to call the constructor of the parent class
Q24. Usage of @Transactional annotation in spring JPA
The @Transactional annotation is used in Spring JPA to manage transactions in database operations.
The @Transactional annotation is used to mark a method or class as transactional.
It ensures that all database operations within the annotated method or class are executed within a single transaction.
If an exception occurs, the transaction is rolled back, and changes made within the transaction are not persisted.
The @Transactional annotation can be used with different propagation ...read more
A correlated subquery is a subquery that references a column from the outer query, allowing for more complex filtering and data retrieval.
Correlated subqueries are executed for each row processed by the outer query.
They can be used to filter results based on values from the outer query.
Example: SELECT * FROM table1 t1 WHERE t1.column1 = (SELECT MAX(column2) FROM table2 t2 WHERE t2.column3 = t1.column3);
Use the SQL JOIN clause to combine two tables based on a related column.
Use the JOIN clause to specify the columns from each table that should be used for the join
Common types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN
Example: SELECT * FROM table1 JOIN table2 ON table1.column = table2.column
Spring Boot is a framework that simplifies the development of Java applications by providing production-ready features out of the box.
Auto-configuration: Spring Boot automatically configures the application based on dependencies added to the project.
Embedded server: Spring Boot includes an embedded Tomcat, Jetty, or Undertow server for running applications without needing to deploy to a separate server.
Actuator: Built-in monitoring and management features like health checks, ...read more
MVC in Spring is a design pattern that separates an application into three main components: Model, View, and Controller.
Model represents the data and business logic of the application.
View is responsible for rendering the user interface based on the data from the Model.
Controller handles user input, processes requests, and updates the Model accordingly.
Spring MVC provides annotations like @Controller, @RequestMapping, and @ModelAttribute to implement MVC architecture.
Example:...read more
Spring Boot is a framework that simplifies the development of Java applications by providing pre-configured settings and tools.
Spring Boot eliminates the need for manual configuration by providing defaults for most settings.
It includes embedded servers like Tomcat, Jetty, or Undertow, making it easy to run applications without deploying WAR files.
Spring Boot also offers a wide range of plugins to enhance development productivity, such as Spring Initializr for project setup.
Q30. Sort using JCL and COBOL
Sorting using JCL and COBOL
JCL can be used to submit a COBOL program for sorting
COBOL program can use SORT verb to sort data
Sorting can be done based on specific fields or criteria
COBOL program can use SORT-RETURN to check the status of the sort operation
Spring Batch is a lightweight, comprehensive framework for batch processing in Java.
Spring Batch provides reusable functions for processing large volumes of data.
It supports reading, processing, and writing data in chunks.
It includes features like transaction management, job processing, and job scheduling.
Example: Using Spring Batch to process and import large CSV files into a database.
Q32. Cursor in DB2
Cursor is a database object used to manipulate data in a result set.
Cursor is used to fetch a set of rows from a result set.
It allows the application to move forward and backward through the result set.
Cursor can be declared and opened in SQL.
It can be used to update or delete rows in a result set.
Cursor can be closed explicitly or implicitly.
Interview Process at Bajaj Finance
Top Software Consultant Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month