Add office photos
Engaged Employer

LTIMindtree

3.8
based on 20.9k Reviews
Filter interviews by

Infosys Interview Questions and Answers

Updated 21 Dec 2024
Popular Designations

Q1. If I add 2 same attribute values for a object to a set...will I see 2 objects in the set, if yes what changes you make to the code to insert unique objects to a set

Ans.

No, you will not see 2 objects in the set. To insert unique objects to a set, you can override the equals() and hashCode() methods in the object class.

  • In a set, each element must be unique based on the equals() method. If you add 2 objects with the same attribute values, only one will be stored in the set.

  • To ensure uniqueness, override the equals() and hashCode() methods in the object class. This will define how objects are compared and stored in the set.

  • For example, if you h...read more

Add your answer

Q2. Given a sorted array of integers, write a function to perform a binary search to find the index of a target value. If the target value is not found, return -1.

Ans.

Binary search function to find target value in sorted array

  • Define function that takes sorted array and target value as input

  • Initialize variables for start, end, and middle indices

  • Use while loop to iterate until start is less than or equal to end

Add your answer

Q3. How is dependency injection different from dependency inversion

Ans.

Dependency injection is a design pattern where dependencies are provided to a class from the outside, while dependency inversion is a principle that states high-level modules should not depend on low-level modules, but both should depend on abstractions.

  • Dependency injection is a technique to achieve dependency inversion.

  • Dependency injection involves providing dependencies to a class from the outside, typically through constructor injection or setter injection.

  • Dependency inver...read more

Add your answer

Q4. Write a Generic method to add string or integer to List or List

Ans.

Create a generic method to add string or integer to List or List

  • Create a generic method that takes a List and an element as input

  • Use Java generics to specify the type of List and element

  • Check the type of List and element, then add the element to the List

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

Q5. What is serialisation, externalisation, serializable

Ans.

Serialisation is the process of converting an object into a format that can be easily stored or transmitted. Externalisation is a way to customize the serialization process. Serializable is an interface in Java that allows objects to be serialized.

  • Serialisation is the process of converting an object into a format that can be easily stored or transmitted

  • Externalisation is a way to customize the serialization process

  • Serializable is an interface in Java that allows objects to be...read more

Add your answer

Q6. Given a string, write a function to reverse the string.

Ans.

Function to reverse a given string

  • Create an empty string to store the reversed string

  • Iterate through the input string in reverse order and append each character to the new string

  • Return the reversed string

Add your answer

Q7. What is concurrent hashmap

Ans.

ConcurrentHashMap is a thread-safe implementation of the HashMap class in Java.

  • ConcurrentHashMap allows multiple threads to read and write to the map concurrently without causing any data corruption.

  • It achieves thread-safety by dividing the map into segments, each of which can be locked independently.

  • ConcurrentHashMap is more efficient than using synchronized collections for concurrent access.

  • Example: ConcurrentHashMap map = new ConcurrentHashMap<>();

Add your answer

Q8. What is dependency injection

Ans.

Dependency injection is a design pattern in which components are given their dependencies rather than creating them internally.

  • Dependency injection helps in achieving loose coupling between classes.

  • It allows for easier testing and swapping of dependencies.

  • There are three types of dependency injection: constructor injection, setter injection, and interface injection.

Add your answer

Q9. What is solid principles

Ans.

SOLID principles are a set of five design principles that help developers create more maintainable and scalable software.

  • 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 program's correctness.

  • I - Interface Segr...read more

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Infosys

based on 3 interviews
1 Interview rounds
Technical Round
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Full Stack Software Developer Interview Questions from Similar Companies

3.8
 • 28 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

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