Oyo Interview Questions
Practice with real Oyo interview questions
01
A Backend Developer was asked
Asked in 2024
Q. What are database transactions, and how does indexing improve database performance? Provide SQL examples.
Ans. A database transaction is a sequence of operations performed as a single logical unit of work. A transaction must be atomic (all or nothing), consistent (valid state), isolated (no interference), and durable (persistent changes). Transactions are managed using SQL commands such as BEGIN, COMMIT, and ROLLBACK.
Example of a Database Transaction:
If any operation fails, you can rollback to the original state:
Indexing improves database performance by creating a data structure that allows for faster retrieval of records. An index is like a book's index that helps find information quickly without scanning the entire table.
Example of Creating an Index:
This index will speed up queries that search for orders by user_id, significantly improving performance in large datasets.
Backend DeveloperCore Concept
02
A Software Engineer was asked
Asked in 2024
Q. Can you explain the basic sorting algorithms and demonstrate the implementation of bubble sort and selection sort in Python?
Ans. Sorting algorithms are fundamental in computer science. Two basic sorting algorithms are Bubble Sort and Selection Sort. Here's how they work:
Bubble Sort repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. The process is repeated until the list is sorted.
Selection Sort divides the input list into two parts: a sorted and an unsorted region. It repeatedly selects the smallest (or largest) element from the unsorted region and moves it to the end of the sorted region.
Both algorithms are simple and easy to understand, but they are not the most efficient for large datasets. Their time complexity is O(n^2) in the worst case. However, they are great for educational purposes and understanding the basics of sorting.
Software EngineerCore Concept
