Facebook Interview Question for Software Engineer / Developers

Country: United States
Interview Type: In-Person

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

1) TCP based session establishment (process based system where each request is handled by a forking/preforking a new process instance.)
2) Per user session created. Session class can look like:

class HMSession
                 string userid;
                 string word;
                 int [] correct_guesses;  // positions guessed already
                 int chances_left;
                 bool isGuessCorrect(char c);
                 string getRandomWord();
                 bool guessChar(char c);
                 bool guessWord(string word);

3) Basic operations expected will be searching for presence of given char in the string to be guessed and updating number of turns left.
4) I think the request-responses can be synchronous. Operations to be done are pretty basic. Single server should be able to serve 100s of users concurrently without any significant latency.
5) Since the user data is confined in the process'es address space boundaries concurrency issues should not come in picture.
6) Session info will be in-memory (if scores are to be kept, those can be written to disk). User info should also be saved as cookies, so if connection is lost the game can be resumed easily.
7) These Hangman servers can be behind a load-balancer who can simply serve in requests in a round-robin manner or sophisticated monitoring system can be built for health checking and keeping track of current load on a system.
8) New hosts can be added to the load balancer or inactive/dead hosts can be removed without the needing any special configuration.

Please point out issues and pour in ideas.

- Second Attempt November 19, 2012 | Flag Reply

Add a Comment

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


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


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