Add office photos
Employer?
Claim Account for FREE

Accenture

3.9
based on 52.4k Reviews
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by

40+ Interview Questions and Answers

Updated 21 Oct 2024
Popular Designations

Q1. What are the principles of object oriented programming, such as OOPs concepts in Java

Ans.

Object-oriented programming (OOP) principles in Java include encapsulation, inheritance, polymorphism, and abstraction.

  • Encapsulation: Bundling data and methods together into a single unit (class) to hide implementation details.

  • Inheritance: Creating new classes (subclasses) from existing classes (superclasses) to inherit properties and behaviors.

  • Polymorphism: The ability of an object to take on many forms, allowing objects of different classes to be treated as objects of a com...read more

View 3 more answers

Q2. Write a code of prime numbers 1 to 100 and write sql query.

Ans.

Code for prime numbers 1 to 100 and SQL query.

  • Use a loop to iterate through numbers 1 to 100.

  • For each number, check if it is divisible by any number from 2 to itself-1.

  • If not divisible, it is a prime number.

  • SQL query: SELECT * FROM table_name WHERE number_column >= 1 AND number_column <= 100 AND is_prime = true;

View 1 answer

Q3. What is the difference between ArrayList and LinkedList?

Ans.

ArrayList is a resizable array implementation, while LinkedList is a doubly linked list implementation.

  • ArrayList uses an array to store elements, allowing fast random access but slower insertions and deletions.

  • LinkedList uses nodes with references to previous and next elements, allowing fast insertions and deletions but slower random access.

  • ArrayList is more suitable for scenarios where random access is frequent, while LinkedList is better for frequent insertions and deletion...read more

Add your answer

Q4. How to handle the versions in rest api

Ans.

Versions in REST API can be handled using URL versioning, header versioning, or media type versioning.

  • URL versioning involves adding the version number in the URL path, e.g. /api/v1/users

  • Header versioning involves adding the version number in the request header, e.g. X-API-Version: 1

  • Media type versioning involves adding the version number in the media type, e.g. application/vnd.company.v1+json

  • Choose a versioning strategy based on the API's requirements and client needs.

Add your answer
Discover null interview dos and don'ts from real experiences

Q5. segregate the employee list whose name starts with any particular alphabet

Ans.

Segregate employee list by first alphabet of name

  • Create a map with alphabet as key and list of employees as value

  • Iterate through employee list and add each employee to corresponding alphabet key

  • Return the map with segregated employee lists

Add your answer

Q6. Collections of java and their comparisons and performance

Ans.

Overview of Java collections and their performance

  • Java collections are used to store and manipulate groups of objects

  • ArrayList is faster for accessing elements, LinkedList is faster for adding/removing elements

  • HashSet is faster for adding/removing elements, TreeSet is faster for searching/sorting elements

  • HashMap is faster for adding/removing elements, TreeMap is faster for searching/sorting elements

Add your answer
Are these interview questions helpful?

Q7. How to developing the java?

Ans.

Java development involves writing, testing, and deploying code using Java programming language.

  • Write code using Java programming language

  • Test the code using various testing frameworks like JUnit

  • Deploy the code using tools like Maven or Gradle

  • Use Integrated Development Environments (IDEs) like Eclipse or IntelliJ IDEA for development

  • Follow coding best practices and design patterns

  • Collaborate with team members using version control systems like Git

View 2 more answers

Q8. what happens if application properties file is removed

Ans.

The application will not be able to read the properties specified in the file, leading to potential errors or failures.

  • The application may fail to start or function properly if it relies on specific properties defined in the file.

  • Any configurations or settings specified in the properties file will not be applied.

  • The application may throw exceptions or errors related to missing properties or configurations.

  • It is important to ensure that the properties file is present and corre...read more

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. What design pattern you used?

Ans.

I have used the Singleton design pattern in my Java projects.

  • Singleton pattern ensures that only one instance of a class is created and provides a global point of access to it.

  • It is useful when we want to limit the number of instances of a class to one.

  • Example: Creating a Logger class as a Singleton to ensure only one instance is used throughout the application.

Add your answer

Q10. Can we perform Multiple inheritance in JAVA?

Ans.

No, Java does not support multiple inheritance.

  • Java does not support multiple inheritance to avoid the Diamond Problem.

  • Instead, Java supports multiple interface inheritance.

  • Example: Class A extends Class B and Class C, which both have a common method. This would lead to ambiguity in Java.

Add your answer

Q11. Iteration of a arraylist by using stream

Ans.

Iterating an ArrayList using stream in Java

  • Convert the ArrayList to a stream using stream() method

  • Use forEach() method to iterate through the stream

  • Use lambda expression to perform an action on each element

  • Example: myList.stream().forEach(element -> System.out.println(element));

Add your answer

Q12. Spring boot application context

Ans.

Spring Boot application context is a container that manages the lifecycle of beans and provides dependency injection.

  • Spring Boot application context is responsible for creating and managing beans.

  • It provides dependency injection by wiring beans together.

  • It supports different types of scopes for beans such as singleton, prototype, etc.

  • It can be configured using annotations or XML configuration files.

  • Example: @ComponentScan scans the package for annotated components and registe...read more

Add your answer

Q13. what is java inheritance..?

Ans.

Java inheritance is a mechanism where one class acquires the properties and behaviors of another class.

  • Inheritance allows code reusability and saves time and effort in coding.

  • The class that is being inherited from is called the superclass or parent class.

  • The class that inherits from the superclass is called the subclass or child class.

  • The subclass can access all the public and protected methods and fields of the superclass.

  • Example: class Car extends Vehicle, where Vehicle is ...read more

Add your answer

Q14. what is exception handling...?

Ans.

Exception handling is the process of handling errors that occur during program execution.

  • Exceptions are objects that represent errors or exceptional events.

  • Exception handling involves catching and handling these exceptions.

  • It helps prevent program crashes and allows for graceful error recovery.

  • Examples of exceptions include NullPointerException, ArrayIndexOutOfBoundsException, and IOException.

Add your answer

Q15. Difference between Overloading and Overriding

Ans.

Overloading is when multiple methods have the same name but different parameters. Overriding is when a subclass provides a specific implementation of a method inherited from its superclass.

  • Overloading is resolved at compile-time based on the method signature.

  • Overriding is resolved at runtime based on the actual object type.

  • Overloading is used to provide different ways to call a method with different parameters.

  • Overriding is used to provide a specific implementation of a metho...read more

Add your answer

Q16. What is wait, notify, notifyall

Ans.

wait, notify, and notifyAll are methods used for inter-thread communication in Java.

  • wait() method causes the current thread to wait until another thread invokes the notify() or notifyAll() method for this object.

  • notify() method wakes up a single thread that is waiting on this object's monitor.

  • notifyAll() method wakes up all threads that are waiting on this object's monitor.

Add your answer

Q17. coding on Stream API filtering numbers

Ans.

Filter numbers using Stream API in Java

  • Use filter() method to specify the condition for filtering numbers

  • Use mapToInt() method to convert Stream of numbers to IntStream

  • Use collect() method to collect the filtered numbers into a list

Add your answer

Q18. Difference between controller and rest controller

Ans.

Controller is a general term for classes that handle requests in a web application, while RestController specifically handles RESTful requests.

  • Controller is a general term for classes that handle requests in a web application

  • RestController is a specialized type of controller that specifically handles RESTful requests

  • RestController is annotated with @RestController, while Controller is annotated with @Controller

  • RestController returns data directly in the response body, while C...read more

Add your answer

Q19. what is method overloading?

Ans.

Method overloading is when a class has multiple methods with the same name but different parameters.

  • Method overloading allows for more flexibility in method calls.

  • The methods must have different parameter types or number of parameters.

  • Example: void print(int num), void print(String str), void print(int num1, int num2)

  • Overloading is determined at compile-time based on the method signature.

Add your answer

Q20. Abstract class and Interface Difference

Ans.

Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.

  • Abstract class can have constructor, fields, and methods, while interface cannot have any of these.

  • A class can implement multiple interfaces but can only extend one abstract class.

  • Abstract classes are used to define common behavior among subclasses, while interfaces are used to define a contract for classes to implement.

  • Example: Abstract class - Animal with abstract ...read more

Add your answer

Q21. Different SpringBoot Annotations

Ans.

SpringBoot annotations are used to simplify the development process by providing shortcuts for common tasks.

  • 1. @SpringBootApplication - marks the class as a Spring Boot application

  • 2. @RestController - marks the class as a controller where methods return data directly instead of a view

  • 3. @Autowired - injects a bean by type

  • 4. @GetMapping, @PostMapping, @PutMapping, @DeleteMapping - map HTTP methods to controller methods

  • 5. @Component, @Service, @Repository - marks a class as a S...read more

Add your answer

Q22. Annotations used in Spring and REST

Ans.

Annotations like @RestController, @RequestMapping, @Autowired are used in Spring for defining RESTful services.

  • Annotations like @RestController, @RequestMapping, @Autowired are used in Spring for defining RESTful services

  • Annotations like @GetMapping, @PostMapping, @PutMapping, @DeleteMapping are used for mapping HTTP methods to controller methods

  • Annotations like @PathVariable, @RequestParam are used for handling request parameters in RESTful services

Add your answer

Q23. .diff between heap and stack memo

Ans.

Heap is used for dynamic memory allocation, while stack is used for static memory allocation.

  • Heap memory is used for storing objects and is managed by the JVM, while stack memory is used for storing method calls and local variables.

  • Heap memory is larger in size compared to stack memory.

  • Heap memory is accessed randomly, while stack memory is accessed in a LIFO (Last In First Out) manner.

  • Examples: Objects created using the 'new' keyword are stored in the heap, while method call...read more

Add your answer

Q24. What is lambda expression

Ans.

Lambda expression is a concise way to represent an anonymous function in Java.

  • Lambda expressions are used to provide implementation of functional interfaces.

  • They enable you to treat functionality as a method argument, or code as data.

  • Syntax: (parameters) -> expression or (parameters) -> { statements; }

  • Example: (int a, int b) -> a + b

Add your answer

Q25. what are SOLID principles?

Ans.

SOLID principles are a set of five design principles that help 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 functionality.

  • I - Interface ...read more

Add your answer

Q26. What is the use of autowire

Ans.

Autowire is used in Spring framework to automatically inject dependencies into a bean.

  • Autowire eliminates the need for manual wiring of dependencies in Spring beans

  • It can be used with @Autowired annotation in Spring

  • There are different types of autowiring modes like 'byType', 'byName', 'constructor', 'no'

  • Example: @Autowired private UserService userService;

Add your answer

Q27. What Is encapsulation

Ans.

Encapsulation is the process of hiding implementation details and providing access to only necessary information.

  • Encapsulation is achieved through access modifiers like private, public, and protected.

  • It helps in achieving data security and prevents unauthorized access.

  • Encapsulation also helps in achieving code maintainability and flexibility.

  • For example, a class can have private variables and public methods to access those variables.

  • This way, the implementation details are hi...read more

Add your answer

Q28. Difference between spring and springboot

Ans.

Spring is a framework for building Java applications, while Spring Boot is a tool that simplifies the setup and configuration of Spring applications.

  • Spring is a comprehensive framework for building Java applications, providing support for various modules like Spring MVC, Spring Security, and Spring Data.

  • Spring Boot is an opinionated tool that simplifies the setup and configuration of Spring applications by providing defaults for dependencies and configurations.

  • Spring Boot inc...read more

Add your answer

Q29. What is inheritance

Ans.

Inheritance is a mechanism in OOP where a new class is derived from an existing class.

  • It allows the new class to inherit the properties and methods of the existing class.

  • The existing class is called the superclass or parent class, and the new class is called the subclass or child class.

  • The subclass can add new properties and methods or override the existing ones.

  • Example: A Car class can be a superclass, and a SportsCar class can be a subclass that inherits the properties and ...read more

Add your answer

Q30. What is oops ?

Ans.

Object-oriented programming (OOP) 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.

  • OOP is based on the concept of classes and objects.

  • Encapsulation, inheritance, and polymorphism are key principles of OOP.

  • Java is an example of an object-oriented programming language.

Add your answer

Q31. What is kubernets?

Ans.

Kubernetes is an open-source container orchestration platform for automating deployment, scaling, and management of containerized applications.

  • Kubernetes helps in automating the deployment, scaling, and management of containerized applications.

  • It allows for easy scaling of applications by adding or removing containers based on demand.

  • Kubernetes provides features like self-healing, load balancing, and rolling updates for applications.

  • It simplifies the management of containers ...read more

Add your answer

Q32. What is constructor?

Ans.

A constructor is a special type of method that is used to initialize objects in a class.

  • Constructors have the same name as the class and do not have a return type.

  • They are called automatically when an object is created.

  • Constructors can be used to set initial values for object attributes.

  • Example: public class Car { public Car() { // constructor code here } }

Add your answer

Q33. What is String?

Ans.

String is a sequence of characters used to represent text in programming languages like Java.

  • Strings are immutable in Java, meaning their values cannot be changed once they are created.

  • Strings can be created using double quotes, like "Hello, World!".

  • String class in Java provides many useful methods for manipulating strings, such as substring(), length(), and indexOf().

Add your answer

Q34. What is object

Ans.

An object is an instance of a class that encapsulates data and behavior.

  • Objects have state and behavior

  • They can interact with other objects through methods

  • Objects can be created from classes

  • Example: A car object has state (color, model) and behavior (drive, stop)

  • Example: A person object has state (name, age) and behavior (eat, sleep)

Add your answer

Q35. What is polymorphism

Ans.

Polymorphism is the ability of an object to take on many forms.

  • Polymorphism allows objects of different classes to be treated as if they are of the same class.

  • It is achieved through method overriding and method overloading.

  • Example: A parent class Animal can have child classes like Dog, Cat, and Bird. All these child classes can have their own implementation of the method 'makeSound', which is overridden from the parent class.

  • Polymorphism helps in achieving code reusability an...read more

Add your answer

Q36. Current work structure

Ans.

Currently working as a Java Developer at XYZ Company, responsible for developing and maintaining Java applications.

  • Developing and maintaining Java applications

  • Collaborating with team members on projects

  • Participating in code reviews and debugging

  • Implementing new features and enhancements

  • Troubleshooting and resolving technical issues

Add your answer

Q37. Explain polymorphism in Java

Ans.

Polymorphism in Java allows objects of different classes to be treated as objects of a common superclass.

  • Polymorphism is achieved through method overriding and method overloading.

  • Method overriding allows a subclass to provide a specific implementation of a method that is already provided by its superclass.

  • Method overloading allows multiple methods with the same name but different parameters to coexist in the same class.

  • Polymorphism helps in achieving flexibility and reusabili...read more

Add your answer

Q38. explain features of java 8

Ans.

Java 8 introduced several new features including lambda expressions, functional interfaces, streams, and default methods.

  • Lambda expressions allow you to write code in a more concise and readable way.

  • Functional interfaces enable the use of lambda expressions.

  • Streams provide a way to work with sequences of elements efficiently.

  • Default methods allow interfaces to have method implementations.

  • The new Date and Time API provides better handling of date and time.

  • Method references all...read more

Add your answer

Q39. Features of java 8

Ans.

Java 8 introduced several new features including lambda expressions, functional interfaces, streams, and default methods.

  • Lambda expressions allow for more concise code and enable functional programming.

  • Functional interfaces are interfaces with a single abstract method, used for lambda expressions.

  • Streams provide a way to work with sequences of elements and support parallel processing.

  • Default methods allow interfaces to have method implementations.

  • Optional class helps to avoid...read more

Add your answer

Q40. reverse an array

Ans.

Reverse an array of strings

  • Create a new array of the same size

  • Iterate through the original array in reverse order and populate the new array

  • Return the new reversed array

Add your answer

Q41. explain spring boot

Ans.

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 allows for standalone Spring applications that can be started with a simple 'java -jar' command.

  • Spring Boot includes embedded servers like Tomcat, Jetty, or Undertow for deploying web applications.

  • It offers a wide range of plugins and extensions for eas...read more

Add your answer

More about working at Accenture

Top Rated Mega Company - 2024
Top Rated Company for Women - 2024
Top Rated IT/ITES Company - 2024
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at null

based on 29 interviews in the last 1 year
2 Interview rounds
Technical Round
HR Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Java Developer Interview Questions from Similar Companies

4.0
 • 18 Interview Questions
3.6
 • 12 Interview Questions
4.6
 • 11 Interview Questions
3.3
 • 11 Interview Questions
3.7
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter