Microsoft Interview Question for Software Engineer / Developers


Country: United States
Interview Type: Phone Interview




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

Class ICommand
	execute();
//All command flags should be listed here, 
//execute method will work on the basis
//of flag value
enum CommandTypes
	POWER_OFF,
	POWER_ON,
	-
	-
Class  Command implements ICommand
	up()
	down()
	off()
	on()
Class VideoCommand extends  Command
	changeVideoSettings();
Class AudioCommand extends  Command
	changeAudioSettings();
public class Button 
	Command c; 
        Button(Command c);
	click(); // Click will execute command
Class Remote
	Button videoButton;
	Button audioButton;

	powerOn();
	powerOff();

- Ajeet October 31, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

ICommand is interface

- Ajeet October 31, 2013 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

IDIOTS.

- Anonymous November 01, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Remote newRemote = new Remote();
Button newButton = new Button(color, name);
Battery newBattery = new Battery(someVolt);
//changes the battery
newRemote.updateBatteries(newBattery);
//add a button to its internal hashmap that has name associated with buttons.
newRemote.addButton(newButton);
//to press a button on remote you can say
newRemote.getButton("power").execute();
So the above end code will tell you that you need a Button class, a Battery class.
To take it further. The Button class can have a execute() function. Battery could have getRemainingPower() function.

- ambu.sreedharan October 30, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Base class button{
//common setters and getter variables
//common methods declared abstract and called virtually
}
class channel extends button {

//channel specific getters and setters and methods
}

class volume extends button {

//volume specific getters and setters and methods
}
class power extends button{

//power specific getters and setters and methods
}

//Not sure of the below two.
class battery{
}

class remote{
}

- AVK October 30, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Classes you could have are..Also you could follow the Observer pattern..

/**
*All actions are funneled through this class..gets the actionStr and publishes it..
*/

class Remote implements Observable { make,model,.. , List<Button>, publish() }

class Button { name, actionStr }

/**
Set of common actions in the Action class and Controller also observes the changes to button's state (which is published by Remote)
*/
class Controller extends Action implements Observer { .. sendSignals() {..} }

- maverick_88 October 30, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Implement Command Design pattern

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

Remote control for what? What is the scenario?

- Anonymous October 31, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

it is not specified. I asked for explanation but he again told me that "design remote controller for me".

- cccorez November 03, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Is it a remote controller for an alarm clock for the deaf, by any chance?

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

Remote controller for him ... was he going to control himself with the remote ?

- cs January 11, 2014 | 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