AmbitionBox
20+ Interview Questions and Answers
Q1. What is the difference between a stack and a queue? Give an example where you would use each.
A stack is a LIFO data structure while a queue is a FIFO data structure.
Stack: Last In First Out (LIFO), used in undo/redo functionality, backtracking, and recursion.
Queue: First In First Out (FIFO), used in job scheduling, breadth-first search, and printing.
Stack uses push() and pop() operations while queue uses enqueue() and dequeue() operations.
Q2. What is the difference between a compiler and an interpreter?
A compiler translates the entire program into machine code before execution, while an interpreter translates and executes the program line by line.
A compiler converts the source code into an executable file, while an interpreter executes the code directly.
Compilers typically produce faster and more efficient code, while interpreters provide faster development and debugging.
Examples of compilers include GCC, Clang, and Visual C++, while examples of interpreters include Python,...read more
Q3. In a party of N people, only one person is known to everyone. Such a person may be present in the party, if yes, (s)he doesn't know anyone in the party. Find this celebrity (is present).
Find the celebrity in a party of N people where only one person is known to everyone.
The celebrity doesn't know anyone in the party.
We can use a stack to keep track of potential celebrities.
If a person knows someone, they cannot be a celebrity.
If a person doesn't know someone, we can push them onto the stack.
After iterating through all people, we check if the stack has only one person and if that person is known to everyone.
Q4. Trapping Rain-Water problem: Given N non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
Compute amount of water trapped in an elevation map after raining
Iterate through the array and find the maximum height on the left and right of each bar
Calculate the amount of water that can be trapped on each bar using the difference between the minimum of the two maximum heights and the height of the bar
Add up the amount of water trapped on each bar to get the total amount of water trapped
Q5. Reverse a given Linked List. Both O(1) and O(N) space complexity. Where N is the size of Linked List.
Reverse a given Linked List with O(1) and O(N) space complexity.
For O(1) space complexity, use three pointers to reverse the links in place.
For O(N) space complexity, use a stack to store the nodes and then pop them to create the reversed list.
Be careful with edge cases such as empty list or list with only one node.
Q6. Given a dictionary with {Key, Value} as {String, Integer}. Sort the given dictionary in ascending/descending order according to: 1) Key. 2) Value.
Sort a dictionary by key or value in ascending/descending order.
Use sorted() function with lambda function to sort by key or value.
For ascending order, use reverse=False and for descending order, use reverse=True.
Example: sorted_dict = sorted(dictionary.items(), key=lambda x: x[0], reverse=True)
Q7. Explain in detail the working behind the algorithms of Merge Sort and Quick Sort.
Merge Sort and Quick Sort are sorting algorithms that use divide and conquer approach.
Merge Sort divides the array into two halves, sorts them recursively, and then merges them.
Quick Sort selects a pivot element, partitions the array around the pivot, and recursively sorts the sub-arrays.
Merge Sort has a worst-case time complexity of O(nlogn), while Quick Sort has an average case time complexity of O(nlogn).
Merge Sort is stable, while Quick Sort is not.
Merge Sort requires ext...read more
Q8. What do you do when the system getting more errors
I analyze the error logs and identify the root cause of the errors. Then, I work on fixing the issues.
Analyze the error logs to identify the root cause of the errors
Work on fixing the issues causing the errors
Implement preventive measures to avoid similar errors in the future
Q9. what is c what is python what is data types what is tuple program
C is a programming language, Python is a high-level programming language, data types are classifications of data items, tuple is a data structure in Python.
C is a general-purpose programming language known for its efficiency and flexibility.
Python is a high-level programming language with a focus on readability and simplicity.
Data types are classifications of data items that specify the type of data that can be stored and manipulated.
A tuple in Python is an immutable data str...read more
Q10. Explain the difference b/w quick sort and merge sort ?
Quick sort is a divide and conquer algorithm that sorts the array by selecting a pivot element and partitioning the other elements around it. Merge sort is also a divide and conquer algorithm that divides the array into two halves, sorts them separately and then merges them.
Quick sort has an average time complexity of O(n log n) while merge sort has a time complexity of O(n log n) in all cases.
Quick sort is an in-place sorting algorithm while merge sort requires extra space.
Q...read more
Q11. what is ptyhon how to use this what is data types
Python is a high-level programming language known for its simplicity and readability. It supports multiple programming paradigms.
Python is used for web development, data analysis, artificial intelligence, scientific computing, and more.
To use Python, you need to install the Python interpreter on your system and write code in a text editor or an IDE.
Python has various data types such as integers, floats, strings, lists, tuples, dictionaries, and sets.
Q12. Zigzag traversal of a given binary tree.
Zigzag traversal of a binary tree is a way of traversing the tree in a zigzag pattern.
Use a stack to keep track of nodes to be visited.
For each level, alternate between adding nodes to the stack from left to right and right to left.
Pop nodes from the stack and add their children to the stack in the appropriate order.
Repeat until all nodes have been visited.
Q13. diff b/w quick sort and merge sort
Quick sort is faster but unstable, while merge sort is slower but stable.
Quick sort uses a pivot element to divide the array into two parts and recursively sorts them.
Merge sort divides the array into two halves, sorts them separately, and then merges them.
Quick sort has an average time complexity of O(n log n), while merge sort has a time complexity of O(n log n) in all cases.
Quick sort is not stable, meaning that the relative order of equal elements may change, while merge ...read more
Q14. System Design for Naukri.com platform
System design for Naukri.com platform
Identify user requirements and design the system architecture accordingly
Use scalable and reliable technologies for high traffic handling
Implement features like job search, job posting, resume upload, etc.
Ensure data security and privacy of users
Integrate with third-party services like payment gateways, social media platforms, etc.
Q15. Java introduction and it's invention
Java is a high-level programming language invented by James Gosling at Sun Microsystems in 1995.
Java is an object-oriented language that is platform-independent.
It was designed to have a simple syntax and be easy to learn.
Java is used for developing a wide range of applications, from mobile apps to enterprise software.
Java's popularity is due in part to its robustness, security, and scalability.
Some popular Java-based technologies include Spring, Hibernate, and Apache Struts.
Q16. ADD two linkedlist (Leetcode Question)
Add two linked lists and return the sum as a linked list.
Traverse both linked lists and add the corresponding nodes.
Handle carry over while adding nodes.
Create a new linked list to store the sum and return it.
Q17. What are accpting for salary
I am open to discussing a competitive salary based on my experience and the responsibilities of the role.
I am looking for a fair and competitive salary based on industry standards and my experience
I am open to discussing benefits and other compensation packages
I am willing to negotiate based on the responsibilities of the role
I am looking for a salary that reflects my skills and contributions to the company
Q18. Tell about ur village
I don't have a village.
I grew up in a city.
I have never lived in a village.
I am not familiar with village life.
Q19. Highest subset sum subarray ?
Highest sum of contiguous subarray in an array
Use Kadane's algorithm to find the maximum sum subarray
Initialize max_so_far and max_ending_here to 0
Loop through the array and update max_ending_here and max_so_far
Return max_so_far as the highest subset sum subarray
Q20. What is manual testing
Manual testing is the process of testing software manually without the use of automation tools.
Manual testing involves executing test cases manually to identify defects and issues in the software.
It is a time-consuming process and requires human intervention.
Manual testing is often used for exploratory testing, ad-hoc testing, and usability testing.
Examples of manual testing include functional testing, regression testing, and acceptance testing.
Q21. tell about ur hobies
I enjoy reading, hiking, and playing video games in my free time.
Reading books on various topics
Hiking in local parks and nature reserves
Playing video games on PC and console
Learning new programming languages and technologies
Attending tech meetups and conferences
Top HR Questions asked in null
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month