Senior Software Engineer 1
Senior Software Engineer 1 Interview Questions and Answers for Freshers
Q1. Getting number of unique elements of array with in-place modification
Use hash set to track unique elements while iterating through array and modify array in-place
Iterate through array and add elements to hash set to track unique elements
Modify array in-place by removing duplicates using hash set
Return the size of the hash set as the number of unique elements
Q2. How to implement singleton pattern
Singleton pattern ensures a class has only one instance and provides a global point of access to it.
Create a private static instance variable of the class itself
Make the constructor private to prevent instantiation from outside the class
Provide a static method to access the singleton instance
Q3. What is abstract class
An abstract class is a class that cannot be instantiated and is used as a blueprint for other classes to inherit from.
Cannot be instantiated directly
May contain abstract methods that must be implemented by subclasses
Can have both abstract and non-abstract methods
Used to define common behavior for subclasses
Q4. Binary Search Algorithm
Binary search is a divide and conquer algorithm that efficiently finds the target value within a sorted array.
Divide the array in half and compare the target value with the middle element
If the target value is smaller, search the left half. If larger, search the right half
Repeat the process until the target value is found or the subarray is empty
Q5. Valid Parenthesis String
Check if a string of parentheses is valid
Use a stack to keep track of opening parentheses
Iterate through the string and push opening parentheses onto the stack
When encountering a closing parenthesis, pop from the stack and check if it matches the corresponding opening parenthesis
If stack is empty at the end and all parentheses have been matched, the string is valid
Q6. LRU cache design
LRU cache design involves maintaining a cache with limited capacity and removing the least recently used item when the cache is full.
Use a doubly linked list to keep track of the order of items in the cache.
Implement a hash map to quickly access items in the cache.
When an item is accessed, move it to the front of the linked list to mark it as the most recently used.
When adding a new item to a full cache, remove the item at the end of the linked list, which is the least recent...read more
Share interview questions and help millions of jobseekers 🌟
Senior Software Engineer 1 Jobs
Interview Questions of Similar Designations
Top Interview Questions for Senior Software Engineer 1 Related Skills
Interview experiences of popular companies
Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary
Reviews
Interviews
Salaries
Users/Month