Arista Networks
20+ ICICI Lombard General Insurance Company Interview Questions and Answers
Q1. Why we use trie and its advantages and dis-advantages
Trie is a tree data structure used for efficient retrieval of key-value pairs, commonly used in autocomplete and spell check applications.
Advantages: efficient prefix search, space optimization for storing keys with common prefixes, easy to implement autocomplete and spell check functionalities
Disadvantages: can be memory intensive for large datasets, complex to implement compared to other data structures like hash tables
Example: Trie data structure is commonly used in search...read more
Q2. What are double pointers ?
Double pointers are pointers that store the memory address of another pointer.
Double pointers are used in C and C++ to store the address of a pointer variable.
They are commonly used in functions to modify the value of a pointer passed as an argument.
Example: int **ptr; // declares a double pointer to an integer pointer.
Q3. Running median in stream
Calculate the running median of a stream of numbers.
Use two heaps - a max heap for the smaller half of the numbers and a min heap for the larger half.
Keep the heaps balanced by ensuring the size difference is at most 1.
If the heaps are balanced, the median is the average of the top elements of the two heaps. Otherwise, it is the top element of the larger heap.
Q4. Discuss OOPS in Programming.
OOPS stands for Object-Oriented Programming, a programming paradigm based on the concept of objects.
OOPS focuses on creating objects that contain both data and methods to manipulate that data.
Encapsulation, inheritance, and polymorphism are key principles of OOPS.
Example: Inheritance allows a class to inherit properties and methods from another class, promoting code reusability.
Q5. Design LRU cache
Design a data structure for LRU cache with get and put operations, evicting least recently used item when capacity is reached.
Implement a doubly linked list to keep track of the order of keys based on their usage
Use a hashmap to store key-value pairs for quick access
Update the order of keys in the linked list when a key is accessed or inserted
Evict the least recently used item when the cache reaches its capacity
Q6. In a todo application a user's data is supposed to be synced in multiple devices. When there is a change made in the todo list in one device, the other device's UI needs to update without refresh. How would you...
read moreReal-time synchronization of todo list across multiple devices using short polling and web sockets.
Implement short polling to regularly check for updates on the server and update the UI accordingly.
Use web sockets for real-time communication between devices to instantly push updates to all connected clients.
Maintain a centralized database to store and retrieve the todo list data for all devices.
Utilize a messaging queue system to ensure reliable and ordered delivery of update...read more
Q7. Design a ticket booking platform(Core problem: How would you prevent concurrent ticket booking by multiple users)
Implement session locking to prevent concurrent ticket booking by multiple users.
Implement session locking mechanism to ensure only one user can book tickets at a time.
Use a unique session ID for each user to track their booking process.
Lock the session when a user starts booking tickets and release the lock once the booking is completed.
Display a message to other users trying to book tickets if the session is already locked.
Use server-side validation to prevent users from by...read more
Q8. Find the memory of the given structure (Struct padding is the hint)
The question asks to find the memory of a given structure by considering struct padding.
Struct padding refers to the unused bytes added to align the members of a structure.
To find the memory of a structure, we need to consider the size of each member and the padding added.
The total memory of a structure is the sum of the sizes of its members and the padding.
Q9. Write code to find the position of a number in a BST
Code to find the position of a number in a BST
Implement a recursive function to traverse the BST
Compare the target number with the current node value
If the target is smaller, go to the left subtree; if larger, go to the right subtree
Repeat until the target is found or the subtree is null
Q10. Create a Trie data structure and perform insertion and search on it.
A Trie is a tree-like data structure used for efficient retrieval of strings. It supports insertion and search operations.
A Trie is also known as a prefix tree.
Each node in the Trie represents a character.
The root node represents an empty string.
Each node can have multiple children, each representing a different character.
Insertion involves traversing the Trie and creating new nodes as needed.
Search involves traversing the Trie and checking if the desired string exists.
Tries ...read more
Q11. A string contains parenthesis, curly brackets and square brackets. Check if the string is valid or not.
Check if a string containing parenthesis, curly brackets, and square brackets is valid.
Use a stack to keep track of opening brackets
Pop from stack when encountering a closing bracket, ensuring it matches the corresponding opening bracket
Return false if stack is not empty at the end
Q12. Check if the linked list is palindrome or not
To check if a linked list is a palindrome, compare the first half of the list with the reversed second half.
Traverse the linked list to find the middle node
Reverse the second half of the linked list
Compare the first half with the reversed second half to check for palindrome
Q13. Design a routing table with insert delete and forward functionality. Define its class also
Design a routing table with insert, delete, and forward functionality in a defined class.
Create a class called RoutingTable with methods for insert, delete, and forward
Use a data structure like a hash table or tree to store routing information
Implement insert method to add new routes, delete method to remove routes, and forward method to look up and forward packets
Q14. Internal working of Hashmap in c C++ debugging the code
Hashmap in C/C++ stores key-value pairs using a hash function for fast retrieval.
Hashmap uses a hash function to map keys to indices in an array.
Collision handling is done using techniques like chaining or open addressing.
Hashmap allows for fast insertion, deletion, and lookup of key-value pairs.
Example: std::unordered_map in C++ implements a hashmap.
Debugging hashmap code involves checking hash function, collision resolution, and data retrieval.
Q15. how does packet travel in switch network
Packets travel in a switch network by being forwarded based on the destination MAC address.
Packets are received by the switch on an incoming port.
The switch looks up the destination MAC address in its MAC address table.
If the MAC address is found, the packet is forwarded out the corresponding port.
If the MAC address is not found, the packet is flooded out all ports except the incoming port.
Switches operate at Layer 2 of the OSI model.
Q16. Design google contacts
Google Contacts is a web-based address book application.
Users can add, edit, and delete contacts
Contacts can be organized into groups
Users can import and export contacts
Contacts can be searched and filtered
Integration with other Google services like Gmail and Calendar
Q17. is Linkedlist palindrome or not
A Linkedlist is not inherently a palindrome, but it can be checked for palindrome by comparing the elements from both ends.
To check if a Linkedlist is a palindrome, we can reverse the second half of the list and compare it with the first half.
Alternatively, we can use a stack to store the first half of the list and then compare it with the second half while popping elements from the stack.
For example, if the Linkedlist is '1 -> 2 -> 3 -> 2 -> 1', it is a palindrome.
Q18. Find cycle in linked list
Use Floyd's Tortoise and Hare algorithm to detect cycle in a linked list.
Initialize two pointers, slow and fast, at the head of the linked list.
Move slow pointer by one step and fast pointer by two steps.
If they meet at any point, there is a cycle in the linked list.
If fast pointer reaches the end of the list, there is no cycle.
Q19. String compare using char pointers
Comparing two strings using char pointers in C/C++
Use char pointers to iterate through each character of the strings
Compare characters at each position until a difference is found
Return 0 if strings are equal, -1 if first string is less than second, 1 if first string is greater
Q20. High level design of a cache
A cache is a high-speed data storage layer that stores a subset of data, typically transient in nature, so that future requests for that data are served faster.
Define the cache size and eviction policy
Choose a suitable data structure for the cache (e.g. hashmap, linked list)
Implement methods for adding, retrieving, and removing data from the cache
Consider concurrency control mechanisms to handle multiple access to the cache
Optimize cache performance by using techniques like c...read more
Q21. Memcpy implementation
Q22. Implement Hash Maps
Hash maps are data structures that store key-value pairs and provide efficient lookup, insertion, and deletion operations.
Hash maps use a hash function to convert keys into array indices.
Collisions can occur when multiple keys hash to the same index, requiring collision resolution techniques.
Common collision resolution methods include chaining and open addressing.
Hash maps have an average time complexity of O(1) for basic operations.
Examples of hash maps include Python's dict...read more
More about working at Arista Networks
Top HR Questions asked in ICICI Lombard General Insurance Company
Interview Process at ICICI Lombard General Insurance Company
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month