Amazon Interview Question for SDE-2s


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
1
of 1 vote

I thought of 4 immediate classes:-
---------------------------------

public class AirPlane
{
    // Attributes
    public Integer plane_ID;
    public String airLine;
	
	//some getter,setter
}

public class Flight
{
    // Attributes
       private Integer flight_ID;
       private String from_location;
       private String to_location;
       private TimeStamp departureTime;
       private TimeStamp arrivalTime;
       private String description;
       private Integer plane_FKey; //mapped to plane_ID

    // Operations
    public  TimeStamp getArrivalTime()   {...}
    public  TimeStamp getDepartureTime()  {...}
}


public class Arrivals
{
    // Attributes
    private List<Flight> arrivingFlights;
   
    // Operations
    private  void displayFlights()  {...}
} 

public class Departures
{
    // Attributes
    private List<Flight> departingFlights;
   
    // Operations
    private  void displayFlights()  {...}
}

Who produces the arriving . departure feed ?
Feed pushed to a MQ or what?
Then who has responsibility to consume MQ messeges? What are next classes till updation of display board ?
Any Controller or Manager class - like DashBoard / DashboardController / FlightMonitorController ? What will be their responsibilities ?
What else I'm missing and what correction needed more ?

- AD August 04, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

public class Aircraft
{
// Attribute
private String airLine;
// more attributes like model, no of seats etc
}

public class Flight
{
// Attributes
private Location fromLocation;
private Location toLocation;
private TimeStamp expectedDepartureTime;
private TimeStamp expectedArrivalTime;
private CrewInfo crewDetails;
private PassengerInfo passengerDetails;
private TerminalInfo terminalInfo; // this will have info like check-in counter, gate etc
private FlightStatus flightStatus; // this will have actual arrival, departure time, also status of flight
}


public class FIS
{
// Attributes
private List<Flight> arrivalFlights;
private List<Flight> departureFlights;

// Operations
private List<Flight> getArrivalFlights(Location location);
private List<Flight> getDepartureFlights(Location location);
}

public class DisplayManager {

private FIS fis;
private Display display;
public void displayArrivalFlights(){
Location location = LocManager.getCurrentLocation();
List<Flight> flights = fis.getArrivalFlights(location);
display.display(flights);
}
}
}}}
// There can be various display classes based on how you want to display it
// We do not need to bother about MQ, who populates the data etc, as the question clearly specifies
// It is not the responsibility of the display system

- 4d August 07, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

list should be synchronized
observer should be there on list as soon as it gets updated
I guess caching should not present

- Prateek August 08, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

But I feel to some extent consuming the feed-update is a responsibiity of some class. What your thought ?

- AD August 21, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Please delete the abc, ann,abc comments

- AD August 21, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

abc

- anon August 07, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

aaa

- ann August 07, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

abc

- abc August 07, 2017 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More