Microsoft Interview Question for Software Engineer / Developers


Country: -
Interview Type: In-Person




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

Good Question . I guess it depends on designer how do you design your class. For me..

Base class watch should have private methods like ..

int seconds () // returns seconds from 0-59
int Minutes ()
int Hours ()
// can extends to calender feature

public methods like set and get function

You can now extend this base class to derived class called

class Wrist watch extends Watch
Now putting wrist watch features accordingly..

- hprem991 November 03, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
3
of 3 vote

I suppose it's good to ask the interviewer what the wrist watch should do. Does it just have the time, or does it also have a Material, Price, etc.? From a business perspective (say, if this is part of an ordering system), the time wouldn't even be part of the data. From a timekeeping perspective, the time is important information, and perhaps the only information that needs to be stored. So, it's really important to examine what problem this class will solve.

- eugene.yarovoi November 03, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

good question rajat. i would approach to this question after a lil chat with the interviewer. i would ask him the following questions.
1. should it display date and week day ?
2. should it emit light when the button is pressed ?
3. should it support alarm feature ?
4. should it contain features for displaying heart rate ?

if the answer to all of them is yes then i would design it as:
public class watch{
int sec;
int min;
int hrs;
int day;
int month;
int year;
int alarm;
int heart;

public void settime(){}
public void setdate(){}
public void setalarm(){}
public void stopalarm(){}
public void gettime(){}
public void getdate(){}
public void getalarm(){}
public void displayheartbeat(){}
}


all constructive comments are always welcome. please correct me if i'm wrong or if there is any problem with the answer.

- CAFEBABE January 03, 2012 | 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