Ola Interview Questions
Practice with real Ola interview questions
01
A Software Engineer was asked
Asked in 2024
Q. What are primary keys and foreign keys in a relational database? Provide SQL examples to illustrate these concepts.
Ans. In a relational database, a primary key is a unique identifier for a record in a table, while a foreign key is a field in one table that uniquely identifies a row in another table. Here’s a simple illustration:
In this example, the
user_id in the Users table is defined as the primary key. In the Orders table, user_id serves as a foreign key referencing Users. This ensures that every order is linked to a valid user. If you attempt to insert an order with a user_id that doesn't exist in the Users table, the database will throw an error, maintaining referential integrity.Software EngineerCore Concept
02
A Frontend Developer was asked
Asked in 2024
Q. How to build an accessible star rating component in React JS?
Ans. Creating an accessible star rating component in React involves using semantic HTML elements and ARIA attributes for better screen reader support. Here’s a simple implementation:
This component allows users to click on stars to set their rating and provides keyboard accessibility. The stars change color based on the current rating. It’s important to ensure that your components are usable by all users, including those with disabilities.
Frontend DeveloperCore Concept
