Adeptia
Geodis Overseas Interview Questions and Answers
Q1. What is difference between concurrent hashmap and hashmap?
ConcurrentHashMap allows multiple threads to read/write concurrently, while HashMap is not thread-safe.
ConcurrentHashMap allows multiple threads to read/write concurrently without blocking each other.
HashMap is not thread-safe and can lead to data corruption if accessed by multiple threads simultaneously.
ConcurrentHashMap achieves thread-safety by using internal synchronization mechanisms like locks or CAS operations.
HashMap does not provide any internal synchronization, so e...read more
Q2. what is Reentrant lock?
Reentrant lock is a synchronization primitive that allows a thread to acquire the same lock multiple times.
Allows a thread to acquire the same lock multiple times
Prevents deadlock by allowing a thread to re-enter the lock it already holds
Useful in situations where a method needs to call another method that also requires the same lock
Example: Java's ReentrantLock class
Q3. Count of substring in a string
Count the number of occurrences of a substring in a given string.
Use a loop to iterate through the string and check for the substring at each position.
Use the indexOf method to find the starting index of the substring in the string.
Increment a counter each time the substring is found.
Handle edge cases like empty string or null substring.
Q4. explain Multithreading ?
Multithreading is the ability of a CPU to execute multiple threads concurrently, allowing for parallel processing.
Multithreading allows for better utilization of CPU resources by running multiple threads simultaneously.
Threads share the same memory space, allowing for efficient communication and data sharing.
Examples of multithreading include running multiple tasks in a web server concurrently or processing data in parallel in a video editing software.
Q5. Internal working of hashmap
HashMap is a data structure that stores key-value pairs and uses hashing to quickly retrieve values based on keys.
HashMap internally uses an array of linked lists to store key-value pairs.
When a key-value pair is added, the key is hashed to determine the index in the array where it will be stored.
If multiple keys hash to the same index, a linked list is used to handle collisions.
HashMap uses the hashCode() method of keys to calculate the hash value.
HashMap allows null keys an...read more
Q6. What is polymorphism
Polymorphism is the ability of a function or method to behave differently based on the object it is acting upon.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
It enables a single interface to represent multiple data types.
Examples include method overloading and method overriding in object-oriented programming.
Interview Process at Geodis Overseas
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month