Zerodha Interview Questions
Practice with real Zerodha interview questions
01
A Software Engineer was asked
Asked in 2024
Q. How would you implement a function to count the frequency of elements in an array and identify duplicates? Provide code examples.
Ans. To count the frequency of elements in an array and identify duplicates, we can use a hashmap (or dictionary) to keep track of the count of each element. Here’s a simple approach to achieve this:
Python Example:
Java Example:
In both code examples, we iterate through the array, updating our frequency count in a map. We also track duplicates by checking when the count reaches 2. This solution effectively handles edge cases like empty arrays and works for any integer input.
Software EngineerCore Concept
02
A Backend Developer was asked
Asked in 2024
Q. What are SQL joins? Explain the different types of joins with examples using SQL queries.
Ans. SQL joins are used to combine records from two or more tables in a database based on related columns. The main types of SQL joins are INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.
1. INNER JOIN: Returns records with matching values in both tables.
2. LEFT JOIN: Returns all records from the left table and matched records from the right table. If there is no match, NULL values are returned for columns from the right table.
3. RIGHT JOIN: Returns all records from the right table and matched records from the left table. If there is no match, NULL values are returned for columns from the left table.
4. FULL OUTER JOIN: Returns all records when there is a match in either left or right table records.
These joins are crucial for retrieving data from multiple tables in relational databases effectively.
Backend DeveloperCore Concept
