TechAffinity
ELV Projects Pvt Ltd Interview Questions and Answers
Q1. What is a program to sort a list in descending order?
Use a sorting algorithm like quicksort or mergesort to sort the list in descending order.
Implement a sorting algorithm like quicksort or mergesort to sort the list in descending order.
Modify the comparison function to sort the elements in descending order.
Ensure the sorting algorithm is efficient and handles edge cases like duplicate elements.
Q2. What is the difference between a set and a list?
A set is an unordered collection of unique elements, while a list is an ordered collection of elements that may contain duplicates.
Sets do not allow duplicate elements, while lists can have duplicate elements.
Sets are unordered, meaning the elements do not have a specific order, while lists maintain the order of elements.
Sets are typically used when the existence of an element is more important than the order or frequency, while lists are used when the order and duplicates ma...read more
Q3. Which one is better, Comparator or Comparable?
Comparable is better for natural ordering, while Comparator is better for custom ordering.
Comparable is used to define the natural ordering of objects, while Comparator is used to define custom ordering.
Comparable is implemented by the class whose objects need to be compared, while Comparator is implemented by a separate class.
Comparable uses the compareTo() method to compare objects, while Comparator uses the compare() method.
Example: String class implements Comparable inter...read more
Q4. What is Spring AOP (Aspect-Oriented Programming)?
Spring AOP is a programming paradigm that allows separating cross-cutting concerns from the main application logic.
Spring AOP enables modularization of concerns such as transaction management, logging, security, etc.
It allows defining aspects (cross-cutting concerns) and applying them to multiple classes.
AspectJ is a popular implementation of AOP in Spring framework.
Example: Using AOP to log method execution time across multiple classes.
Q5. What are the uses of HashSet and TreeSet in Java?
HashSet is an unordered collection of unique elements, while TreeSet is a sorted set implemented using a tree structure.
HashSet does not maintain any order of elements, while TreeSet maintains elements in sorted order.
HashSet allows null values and is generally faster for adding, removing, and checking for existence of elements.
TreeSet does not allow null values and provides efficient operations for finding the smallest and largest elements.
HashSet is implemented using a hash...read more
Q6. What is the purpose of an interceptor?
An interceptor is a software design pattern that allows for pre-processing and post-processing of requests and responses.
Interceptors can be used for logging, authentication, authorization, caching, error handling, and more
They can intercept HTTP requests and responses in web applications
Examples include Angular HTTP interceptors, Spring Interceptors in Java, and Axios interceptors in JavaScript
Q7. What is Spring Security?
Spring Security is a powerful and customizable authentication and access control framework for Java applications.
Provides comprehensive security services for Java EE-based enterprise software applications
Supports authentication, authorization, and protection against common security vulnerabilities
Integrates with Spring Framework for seamless security configuration
Allows for easy customization and extension through configuration and programming
Example: Securing REST APIs with ...read more
More about working at TechAffinity
Interview Process at ELV Projects Pvt Ltd
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month