Volkswagen
Physicswallah Interview Questions and Answers
Q1. Coding question find the first non repeting char in the string using java 8.
Using Java 8, find the first non-repeating character in a string.
Use Java 8 streams to convert the string to a character array.
Use Collectors.groupingBy to group characters by count.
Filter out characters with count > 1 and find the first character with count 1.
Q2. Find the sum of all even numbers without using inbuild methods using stream api.
Sum of all even numbers without using inbuild methods using stream api
Create an array of numbers
Use stream to filter out even numbers
Use stream to sum up the filtered even numbers
Q3. Intermediate and terminal operators in Java?
Intermediate and terminal operators are used in Java streams to perform intermediate and terminal operations on elements.
Intermediate operators are used to transform, filter, or manipulate elements in a stream before passing them to the next operation. Examples include map(), filter(), and sorted().
Terminal operators are used to trigger the processing of elements in a stream and produce a result. Examples include forEach(), collect(), and reduce().
Q4. Exception handling in the spiring Boot?
Exception handling in Spring Boot allows developers to gracefully handle errors and provide meaningful responses to users.
Use @ControllerAdvice to handle exceptions globally
Use @ExceptionHandler to handle specific exceptions
Return custom error messages or responses to users
Q5. Various methods in the RestApi?
Various methods in RestApi include GET, POST, PUT, DELETE.
GET - Used to retrieve data from the server. Example: GET /users
POST - Used to send data to the server to create a new resource. Example: POST /users
PUT - Used to update an existing resource on the server. Example: PUT /users/1
DELETE - Used to delete a resource on the server. Example: DELETE /users/1
Q6. Difference between IOC and DI?
IOC is a design pattern where control is inverted, while DI is a technique to achieve IOC by injecting dependencies into a class.
IOC stands for Inversion of Control, where the control of flow is inverted from the traditional top-down approach.
DI stands for Dependency Injection, a technique used to implement IOC by injecting dependencies into a class from an external source.
IOC is a design principle, while DI is a technique to achieve IOC.
Example: In IOC, a framework controls ...read more
Q7. @RequestBody annotation?
Annotation used in Spring framework to bind the HTTP request body to a method parameter.
Used in Spring MVC to indicate that a method parameter should be bound to the body of the web request.
Can be used with various data types like JSON, XML, etc.
Helps in simplifying the process of handling request data in Spring applications.
Q8. type casting in the Java?
Type casting in Java is the process of converting one data type into another.
Type casting can be done implicitly or explicitly in Java.
Implicit type casting is done when a smaller data type is converted to a larger data type, while explicit type casting is done when a larger data type is converted to a smaller data type.
Example of implicit type casting: int num = 10; double result = num;
Example of explicit type casting: double num = 10.5; int result = (int) num;
Q9. Functional interface in java?
Functional interface in Java is an interface with only one abstract method. It can have multiple default or static methods.
Functional interfaces can be annotated with @FunctionalInterface to ensure they have only one abstract method.
Examples of functional interfaces in Java include Runnable, Callable, and ActionListener.
Lambda expressions can be used to implement functional interfaces concisely.
Interview Process at Physicswallah
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month