Xoriant
20+ Interview Questions and Answers
Q1. String is immutable but what happens if we assign another value to that string reference
Assigning another value to a string reference creates a new string object in memory.
Assigning a new value to a string reference creates a new string object in memory
The original string object remains unchanged
The new value is stored in a different memory location
The old value may be garbage collected if there are no other references to it
Q2. try{...}finally{..} what happens if exception thrown from try block
The finally block will always execute, even if an exception is thrown from the try block.
The finally block is used to execute code that should always run, regardless of whether an exception is thrown or not.
If an exception is thrown from the try block, the code in the finally block will still execute.
This is useful for cleaning up resources, such as closing files or database connections.
Example: try { // code that may throw an exception } finally { // code that should always ...read more
Q3. how to get unique values from the collection using stream
To get unique values from a collection using stream, use the distinct() method.
Call the distinct() method on the stream of the collection.
The distinct() method returns a stream of unique elements.
Use the collect() method to convert the stream back to a collection.
Q4. difference between == and equals
The '==' operator compares the reference of objects, while the 'equals' method compares the content of objects.
The '==' operator checks if two objects refer to the same memory location.
The 'equals' method compares the content of objects based on their implementation.
The 'equals' method can be overridden to provide custom comparison logic.
Example: String str1 = new String('hello'); String str2 = new String('hello'); str1 == str2 will be false, but str1.equals(str2) will be tru...read more
Q5. difference between lambda expression and method reference
Lambda expression is an anonymous function while method reference refers to an existing method
Lambda expression is used to create an instance of a functional interface
Method reference is used to refer to an existing method of a class or object
Lambda expression uses the arrow operator (->) to separate the parameters and the body
Method reference uses the double colon (::) operator to separate the class or object and the method name
Q6. Coding Challenge (JS) - determine if words in given array are anagram or not
Determines if words in given array are anagram or not using JS
Create a function that takes an array of strings as input
Loop through the array and sort each string alphabetically
Compare the sorted strings to check if they are equal
Return true if all strings are anagrams, else false
Q7. Coding challenge (JS) - remove duplicate entries from array
Remove duplicate entries from array of strings using JavaScript
Use Set to remove duplicates
Convert Set back to array
Use spread operator to convert Set to array
Q8. tell me about JIT compiler
JIT compiler stands for Just-In-Time compiler. It dynamically compiles code during runtime for improved performance.
JIT compiler translates bytecode into machine code at runtime
It optimizes code execution by identifying frequently executed code and compiling it
Examples include the JIT compilers used in Java Virtual Machine (JVM) and .NET Common Language Runtime (CLR)
Q9. fail fast and fail safe in java with examples
Fail fast and fail safe are two error handling techniques in Java.
Fail fast approach detects errors as early as possible and stops the program execution immediately.
Fail safe approach handles errors gracefully and continues program execution.
Examples of fail fast include NullPointerException and ArrayIndexOutOfBoundsException.
Examples of fail safe include using try-catch blocks and logging errors instead of throwing exceptions.
Q10. Describe AWS tier architecture, Loadbalacer and S3.
AWS tier architecture includes Load Balancer for distributing traffic and S3 for scalable storage.
AWS tier architecture consists of multiple layers such as presentation, application, and data tiers.
Load Balancer helps distribute incoming traffic across multiple instances to ensure optimal resource utilization and prevent overload.
S3 (Simple Storage Service) is a scalable storage solution offered by AWS for storing and retrieving data.
S3 allows for easy management of data thro...read more
Q11. what is concurrent hashmap
ConcurrentHashMap is a thread-safe implementation of the Map interface in Java.
It allows multiple threads to access and modify the map concurrently without any external synchronization.
It achieves this by dividing the map into segments, each of which can be locked independently.
It provides better performance than synchronized HashMap for concurrent access.
It is part of the java.util.concurrent package in Java.
Example: ConcurrentHashMap
map = new ConcurrentHashMap<>();
Q12. internal working of hashmap and hashset
Hashmap and Hashset are data structures used to store key-value pairs and unique values respectively.
Hashmap uses hashing to store key-value pairs in an array. The hash function is used to map the key to an index in the array.
Hashset is similar to Hashmap but only stores unique values. It uses hashing to store values in an array.
Both Hashmap and Hashset have constant time complexity for insertion, deletion, and retrieval operations.
Hashmap allows null values and one null key,...read more
Q13. What are the migration projects handle
Migration projects involve moving data, applications, or infrastructure from one system to another.
Migration of data from on-premises servers to cloud storage
Upgrading software versions and transferring data to new systems
Moving applications from one platform to another, such as from Windows to Linux
Consolidating multiple databases into a single system
Q14. difference between sleep and wait
Sleep pauses the execution of a thread for a specified time, while wait pauses the execution until a specific condition is met.
Sleep is a static method of the Thread class, while wait is an instance method of the Object class.
Sleep is used to introduce a delay in the execution of a thread, while wait is used to wait for a specific condition to be met.
Sleep releases the lock on the object, while wait does not release the lock.
Sleep can be interrupted by another thread, while w...read more
Q15. Internal working of concurrent hashmap
Concurrent hashmap allows multiple threads to access and modify the map concurrently.
Concurrent hashmap is thread-safe and uses internal locking mechanisms to ensure consistency.
It uses a technique called 'lock striping' to divide the map into multiple segments, each with its own lock.
This allows multiple threads to access different segments of the map concurrently without blocking each other.
Concurrent hashmap also uses a technique called 'resizing' to dynamically adjust the...read more
Q16. Iterator and list iterator difference
Iterator is a general interface while ListIterator is specific to List interface.
Iterator can traverse any collection while ListIterator can traverse only List.
ListIterator can traverse in both directions while Iterator can traverse only forward.
ListIterator has additional methods like add(), set(), previous(), etc.
Iterator is used for read-only access while ListIterator is used for both read and write access.
Q17. Serialization in java
Serialization is the process of converting an object into a stream of bytes to store or transmit it.
Java provides Serializable interface to enable serialization of objects.
Serialization can be used for caching, deep cloning, and remote method invocation.
Deserialization is the process of converting a stream of bytes back into an object.
Java also provides Externalizable interface for custom serialization.
Serialization can be controlled using transient and static fields.
Q18. What azure service you worked
I have worked with Azure App Services, Azure Functions, Azure SQL Database, and Azure Blob Storage.
Azure App Services for hosting web applications
Azure Functions for serverless computing
Azure SQL Database for relational database management
Azure Blob Storage for storing unstructured data
Q19. Tell about oops concept
Object-oriented programming paradigm focusing on objects and classes for code organization and reusability.
Encapsulation: Bundling data and methods that operate on the data into a single unit (class)
Inheritance: Ability of a class to inherit properties and behavior from another class
Polymorphism: Ability to present the same interface for different data types
Q20. Diff types of constructor
Different types of constructors in object-oriented programming
Default constructor: no parameters
Parameterized constructor: accepts parameters
Copy constructor: creates a new object as a copy of an existing object
Static constructor: used to initialize static data members of a class
Private constructor: restricts the instantiation of a class to within the class itself
More about working at Xoriant
Top HR Questions asked in null
Interview Process at null
Top Senior Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month