Google Interview Questions
Practice with real Google interview questions
01
A Backend Developer was asked
Asked in 2025
Q. Write an SQL query to find the three highest salaries from an Employee table.
Ans. To find the three highest salaries from an Employee table, you can use the following SQL query with a subquery to rank salaries:
Alternatively, using a subquery for more control:
This query uses the DENSE_RANK() function to assign a rank to each salary, and then selects salaries with a rank of 3 or less. This handles cases where there are ties in the highest salaries.
Backend DeveloperCore Concept
02
A Software Engineer was asked
Asked in 2025
Q. How would you design a microservice that leverages AI for real-time data analysis and generates insights for users? Describe the architecture and key technologies you would use.
Ans. To design a microservice for real-time data analysis utilizing AI, I would adopt an event-driven architecture with a focus on scalability and responsiveness. The architecture would include the following components:
1. Data Ingestion: Use Apache Kafka for streaming data from various sources to our microservice. This allows for high throughput and low-latency data ingestion.
2. Microservice: The core microservice would be built using Node.js or Python (Flask), which would facilitate the real-time processing of incoming data. Using FastAPI can also be a good option for building APIs that need to handle concurrent requests efficiently.
3. AI Model: An AI model (e.g., a machine learning model trained with TensorFlow or PyTorch) would be deployed using TensorFlow Serving or a similar service. This model can analyze incoming data streams and provide insights.
4. Database: For storing processed data, I would choose a NoSQL database like MongoDB, which allows for flexible schema and is suitable for handling unstructured data.
5. API Gateway: Use an API Gateway like Kong or AWS API Gateway for managing traffic, authentication, and routing requests to the microservice.
6. Monitoring and Logging: Implement monitoring using Prometheus and Grafana to keep track of the service's health and performance.
This architecture supports scalability and efficient real-time processing while being able to integrate machine learning insights.
Example of a simplified Python code snippet for data ingestion and processing:
Software EngineerCore Concept
