Add office photos
Engaged Employer

DXC Technology

3.7
based on 9.5k Reviews
Filter interviews by

Optimum Technology Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

Q1. HOW TO CREATE OUR OWN IMMUTABLE CLASS? WHY IMMUTABLE CLASS

Ans.

Immutable classes in Java are classes whose objects cannot be modified once they are created.

  • Make the class final to prevent inheritance

  • Make all fields private and final

  • Do not provide setter methods for fields

  • Ensure that any mutable objects within the class are also immutable

Add your answer

Q2. IN WHICH SITUATION WE USE @PRIMARY AND @ QUALIFIER ?

Ans.

Use @Primary to specify a primary bean when multiple beans of the same type are present. Use @Qualifier to specify a specific bean when multiple beans of the same type are present.

  • Use @Primary to indicate the primary bean to be used when multiple beans of the same type are present in the Spring application context.

  • Use @Qualifier along with @Autowired to specify a specific bean to be injected when multiple beans of the same type are present.

  • Example: @Primary annotation can be ...read more

Add your answer

Q3. WHAT IS DIFFERENCE BETWEEN COMPOSITION AND AGGREGATION ?

Ans.

Composition is a strong relationship where the child object cannot exist independently of the parent object, while aggregation is a weak relationship where the child object can exist independently.

  • Composition is a 'has-a' relationship, where the child object is a part of the parent object.

  • Aggregation is a 'has-a' relationship, where the child object is not a part of the parent object.

  • In composition, the child object is created and destroyed along with the parent object.

  • In agg...read more

Add your answer

Q4. DIFFERENCE BETWEEN INTERFACE AND ABSTRACT CLASS.

Ans.

Interface is a contract with no implementation, while abstract class can have some implementation.

  • Interface cannot have any method implementation, while abstract class can have some method implementations.

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

  • Interfaces are used to achieve multiple inheritance in Java.

  • Abstract classes can have constructors, while interfaces cannot.

  • Example: Interface - Runnable, Abstract Class - Animal with abstract ...read more

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

Q5. DIFFERENCE BETWEEN HASHMAP AND CONCURRENTHASH MAP

Ans.

HashMap is not thread-safe while ConcurrentHashMap is thread-safe.

  • HashMap is not thread-safe and can lead to ConcurrentModificationException if modified during iteration.

  • ConcurrentHashMap allows concurrent read and write operations without the need for external synchronization.

  • ConcurrentHashMap achieves thread-safety by dividing the map into segments, allowing multiple threads to operate on different segments concurrently.

  • ConcurrentHashMap is more suitable for multi-threaded ...read more

Add your answer

Q6. DIFFERENCE BETWEEN COMPARABLE AND COMPARATOR.

Ans.

Comparable is an interface used for natural ordering of objects, while Comparator is an interface used for custom ordering of objects.

  • Comparable interface is implemented by the class whose objects are to be compared, while Comparator interface is implemented by a separate class.

  • Comparable interface has a single method compareTo() for comparing objects, while Comparator interface has a single method compare() for custom comparison logic.

  • Comparable interface is used for natural...read more

Add your answer

Q7. DIFFERENCE BETWEEN COLLECTION AND STREAM

Ans.

Collections store data while streams process data in a functional way.

  • Collections are used to store and manage groups of objects, while streams are used to process collections of objects.

  • Collections are mutable, meaning you can add, remove, or modify elements, while streams are immutable and do not change the original data.

  • Streams use functional programming concepts like map, filter, and reduce to process data efficiently.

  • Collections are eager, meaning they store all elements...read more

Add your answer

Q8. DESCRIBE TYPES JVM MEMORY.

Ans.

JVM memory consists of Young Generation, Old Generation, and Permanent Generation.

  • Young Generation: where new objects are allocated and aged before moving to Old Generation.

  • Old Generation: where long-lived objects are stored.

  • Permanent Generation: where metadata such as class definitions and method information are stored.

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Senior Java Developer Interview Questions from Similar Companies

3.7
 • 23 Interview Questions
3.9
 • 19 Interview Questions
3.8
 • 18 Interview Questions
3.7
 • 16 Interview Questions
3.8
 • 15 Interview Questions
3.7
 • 13 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