Open In App

BharatPe Interview Experience for SDE-2 (1.5 Years Experienced)

Last Updated : 04 Apr, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Round 1:

  1. Write method findPath, which we should be able to call on any variable on type JSON Object/ multi-level dict. Should take keys separated by dots as a string. Return value if it exists at that path, else return undefined.
        obj = {
           'a': {
               'b': {
                   'd': 12,
                   'e': 24
               }
           }
        }
        print(findPath(obj, '.')) # 12
        print(findPath(obj, 'a.b.e')) # {c: 12}
        print(findPath(obj, 'a.b.d')) # None
        print(findPath(obj, 'a.c')) # None
        print(findPath(obj, 'a.b.c.d')) # None
        print(findPath(obj, 'a.b.c.d.e')) # None
  2. We are running an online classroom. Students sign up on our platform. During sign-up, they provide us with their name and the city they come from. Providing a city is optional, so some students do not provide that. Our database schema is as follows.

    We need to write an SQL query to find out how many students we have from each city. The report should have two columns – the left column should have the name of the city and the right column should have the number of students from each city.

    Expected output (order of rows does not matter):

    • Delhi  2
    • Jaipur 1
    • Patna  3
    • null   3
    CREATE TABLE city (
     id INTEGER NOT NULL PRIMARY KEY,
     name VARCHAR(100) NOT NULL
    );
    CREATE TABLE student (
     id INTEGER NOT NULL PRIMARY KEY,
     name vARCHAR(100) NOT NULL,
     city_id INTEGER,
     FOREIGN KEY (city_id) REFERENCES city(id)
    );
    INSERT INTO city
    (id, name)
    VALUES
    (1, 'Delhi'),
    (2, 'Jaipur'),
    (3, 'Patna'),
    (4, 'Pune');
    INSERT INTO student
    (id, name, city_id)
    VALUES
    (1, 'Ravi',    1),
    (2, 'Ajay',    1),
    (3, 'Shubham', 2),
    (4, 'Mansi',   null),
    (5, 'Rachna',  3),
    (6, 'Mohit',   3),
    (7, 'Ankita',  null),
    (8, 'Anshul',  3),
    (9, 'Sanchit', null);
  3. Project Discussion

  4. Different HTTP Event

  5. How indexing works in Relational DB

Round 2:

  • Project discussion
  • Culture of your current firm vs Bharatpe
  • Salary Discussion

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads