Infrrd
10+ Malathi Manipal Hospital Interview Questions and Answers
Q1. Design a layered architecture for saving the user data to db. What all annotations to be used on each class and on functions if any?
Design a layered architecture for saving user data to db with appropriate annotations.
Create a data access layer (DAO) to interact with the database using annotations like @Repository
Implement a service layer to handle business logic with annotations like @Service
Use @Entity annotation on model classes to map them to database tables
Add @Id annotation on primary key fields in model classes
Utilize @Transactional annotation on service methods for transaction management
Q2. Sql query to find nth highest salary. What does limit and offset do?
SQL query to find nth highest salary using LIMIT and OFFSET.
Use ORDER BY salary DESC to sort salaries in descending order.
Use LIMIT 1 OFFSET n-1 to get the nth highest salary.
For example, SELECT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 2 will give the 3rd highest salary.
Q3. Which data structure to use to store data in the order of insertion and also have uniqueness?
LinkedHashSet is the data structure to use for storing data in order of insertion and uniqueness.
LinkedHashSet maintains insertion order and ensures uniqueness of elements.
It uses a combination of LinkedList and HashSet to achieve this.
Example: LinkedHashSet
set = new LinkedHashSet<>();
Q4. Which is better SQL or nosql
It depends on the specific use case and requirements of the project.
SQL is better for structured data and complex queries
NoSQL is better for unstructured data and scalability
Consider the need for ACID compliance and data consistency
Choose based on the project's requirements and scalability needs
Q5. What to choose nodejs or java.
It depends on the specific project requirements and team expertise.
Consider the project requirements - Node.js is great for real-time applications, while Java is better for large-scale enterprise applications.
Evaluate team expertise - If your team is more familiar with JavaScript, Node.js may be the better choice.
Performance - Java is generally faster and more efficient than Node.js.
Scalability - Java is known for its scalability, making it a good choice for growing applicati...read more
Q6. How to handle exception at controller level? Use of restcontrolleradvice
Using RestControllerAdvice to handle exceptions at controller level in Java
Create a class annotated with @RestControllerAdvice to handle exceptions globally
Use @ExceptionHandler annotation in the class to define methods to handle specific exceptions
Return ResponseEntity with appropriate status code and error message in the exception handling methods
Q7. What are closures in JavaScript? Explain using an appropriate example.
Closures in JavaScript are functions that have access to variables from their outer scope even after the outer function has finished executing.
Closures allow functions to access variables from their parent function's scope
They are created whenever a function is defined within another function
Closures can be used to create private variables and functions
Q8. Implement a small error handling thread wxecutor service project in spring boot.
Implement a small error handling thread executor service project in Spring Boot.
Create a Spring Boot project
Implement a custom thread executor service
Handle errors and exceptions in the executor service
Use Spring Boot's error handling mechanisms
Test the error handling functionality
Q9. What is Prototypal Inheritance in JavaScript?
Prototypal Inheritance in JavaScript is a way of creating objects based on existing objects.
In JavaScript, each object has a prototype property which allows one object to inherit properties and methods from another object.
When a property or method is accessed on an object, JavaScript will first look for it on the object itself, then on its prototype, and so on up the prototype chain.
Prototypal Inheritance allows for code reusability and helps in creating a hierarchy of object...read more
Q10. What are the various lifecycle hooks in Angular?
Angular lifecycle hooks are methods that allow you to tap into specific points in a component's lifecycle.
ngOnChanges: Called when an input property changes
ngOnInit: Called once 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 content
ngAfterViewInit: Called after the component's view has been ...read more
Q11. what is oops, abstraction, ioc container, application context
OOPs is a programming paradigm based on the concept of objects. Abstraction is the process of hiding implementation details from the user.
OOPs stands for Object-Oriented Programming.
Abstraction is achieved through encapsulation and inheritance.
IOC container is a framework for implementing Inversion of Control.
Application context is a container for holding beans in Spring Framework.
Q12. Check string is palindrome Reverse number Check if it is anagram Oops related concept were asked
Palindrome and anagram check for strings and reverse number implementation.
To check if a string is palindrome, compare the string with its reverse.
To check if two strings are anagram, sort both strings and compare them.
To reverse a number, use modulo operator and divide the number by 10.
Oops concepts like inheritance, polymorphism, encapsulation, and abstraction were asked.
Interview Process at Malathi Manipal Hospital
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month