Uber Interview Questions
Practice with real Uber interview questions
01
A Software Engineer was asked
Asked in 2024
Q. What are the key differences between a Class and an Object in Object-Oriented Programming? Illustrate with examples.
Ans. In Object-Oriented Programming, a Class is a blueprint for creating Objects. It defines properties and behaviors (methods) that the created Objects will have. An Object is an instance of a Class.
Class: A template that describes the data and behavior of the objects.
Object: A specific instance of a Class containing actual values.
Example:
In this example,
Car is the Class, and car1 and car2 are the Objects created from the Car Class. Each Object has its own attributes (make and model), demonstrating the key differences.Software EngineerCore Concept
02
A Software Engineer was asked
Asked in 2024
Q. Explain the different types of SQL JOINs and provide examples of each. How can you use JOINs to retrieve data from multiple tables?
Ans. SQL JOINs are used to combine rows from two or more tables based on a related column between them. The main types of JOINs are INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN.
1. INNER JOIN: Returns records that have matching values in both tables.
2. LEFT JOIN: Returns all records from the left table and the matched records from the right table. If there is no match, NULL values are returned.
3. RIGHT JOIN: Returns all records from the right table and the matched records from the left table. If there is no match, NULL values are returned.
4. FULL OUTER JOIN: Returns all records when there is a match in either left or right table records. Records without a match will show NULL for the other table’s columns.
These JOINs enable you to retrieve comprehensive data across multiple related tables, enhancing the analysis and reporting capabilities of your database queries.
Software EngineerCore Concept
