Symantec Interview Question for Senior Software Development Engineers


Country: India




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

To answer this question in an interview scenario which merely required me to provide a solution I would attempt to 'think aloud' the solution below;

* The lift object needs to hold 'state'; current direction of travel and current floor (State pattern)

* It also needs to hold a list of external requests (which floor the request came from and the time the request was sent)

* It also needs to hold a list of internal requests (the floor the request to go to and the time the request was received)

* It also needs to know its boundaries (min = 0 (ground floor) and max = n (top floor))

* We will need an orchestrating object to send information to the lift to simulate users (info : floor request from and to)

* The lift object will need to accept the information sent from the orchestrating object, timestamp it and process it, i.e. change its state.

* The lift needs to recalculate which floors to stop at but not change its direction unless there are no more requests for the current direction

... this was without any preparation so have most probably missed some areas but it is similar to the 'Mars Rover' test in which you send commands to a droid which then change the state (position) of the droid.

Hope this helps someone.

- Billy April 05, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

What if it is a lift for lifting sand off of construction sites?

- Anonymous April 06, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Isn't that a crane?

- Billy April 10, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

you can have a controller class
A lift class and the controller class controlling the lift objects
Controller can have methods like SendUp(), sendDown(), HoldList()

- DashDash April 06, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

does this help ?
dsalgointerview.wordpress.com/2013/02/13/design-an-elevator-system-for-a-building/

dsalgointerview.wordpress.com/tag/design-questions/

- Praveen Gupta July 28, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The lift will have a state, so this state can be represented using a state design pattern.
A state would comprise of current direction the lift is going (UP, DOWN) and the current floor number.
States = GoingUp, GoingDown,
When some request comes in then the request would have two parameters (floor number from which the request came, and the direction in which the user wants to go (i.e.UP/DOWN)).
The logic will be like this:
Each time the request comes it will be stored into a queue.
When the lift has completed the current request and is free, it will take the next request from the queue.
It will check what is its current state (direction/floor no.) and take the appropriate action by calling methods on its abstract state pointer.
In case the request is for going down while it is going up and there are suppose n floors and lift is at n-1 floor and someone has placed a reqeust to go down from nth floor, then lift's logic should be such that it should go up and fulfill the request for going down from nth floor first before going down from n-1 th floor.
There might be a better logic so that all the user are served with minimum turn around time(TAT) and average job completion time is minimum.

- Jitendra Singh September 26, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Happy Path testing:
1. Lift is going in a same direction until the final request is served.
2. Lift is functioning well with accepted load.

Negative testing:
1. Testing the behavior of lift when power failure when its idle and functioning.
2. When acceptable high load
3. Speed with out any load
4. When more than acceptable load
5. Recalculate its function (which floor to stop) in every floor based on internal and external requests without changing its direction until there is no more requests available for the same direction.
6. Is automatic doors functioning well
7. If it s manual doors, check how its functioning without closing it
8. function of alarm button, door close and open button
9. check the behavior when fire happens by simulator
10. Speed must not be vary at any time and in any situation
11. check the function of Air condition system inside lift with / without load
12. Check the backup power for lights and air condition system inside life when there is power failure.
13. check the sensors of automatic doors of lift.
14. Able to accept multiple requests at the same time
15. Check the queuing mechanism, if there are more lifts.

- Anonymous October 03, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Lift
{
state : moving, stopped
side : up/Down
currentfloor

openDooe()
closeDoor()
moveUp()
moveDown();

}

Manager
{

queue<Request> RequestQueueUp
queue<Request> RequestQueueDown

Lift * lift

void eventReceived(direction, Floor )
{

if( direction == "UP")
RequestQueueUp.insert( Request(up, floor));
else
RequestQueueUp.insert( Request(down, floor));


}

}

Request
{

requestFromWhichFloor
direction up/down

}

- Anonymous July 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Lift
{
state : moving, stopped
side  : up/Down
currentfloor

openDooe()
closeDoor()
moveUp()
moveDown();

}

Manager
{

queue<Request> RequestQueueUp
queue<Request> RequestQueueDown

Lift * lift

void eventReceived(direction, Floor )
{
   
  if( direction == "UP")
	RequestQueueUp.insert( Request(up, floor));
  else
	RequestQueueUp.insert( Request(down, floor));
	
 
}

}

Request
{

requestFromWhichFloor
direction up/down

}

- Anonymous July 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Lift
{
state : moving, stopped
side : up/Down
currentfloor

openDooe()
closeDoor()
moveUp()
moveDown();

}

Manager
{

queue<Request> RequestQueueUp
queue<Request> RequestQueueDown

Lift * lift

void eventReceived(direction, Floor )
{

if( direction == "UP")
RequestQueueUp.insert( Request(up, floor));
else
RequestQueueUp.insert( Request(down, floor));


}

}

Request
{

requestFromWhichFloor
direction up/down

}

- Prashant July 24, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

jdbcTemplate executing prepare sql statement

- kk June 12, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

abe pahle apni cading to theek kar

- Anonymous October 25, 2019 | 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