TCS Company General Ability General Knowledge

Refer to the diagram above. It is a walk-in-interview setup having an interview room with one chair and a waiting room with a number of chairs. The interviewer interviews candidates in the interview room. When the interviewer finishes interviewing a candidate, he dismisses the candidate and goes to the waiting room to see if there are other candidates waiting. If there are, he brings one of them to his room and interviews him. If there are no candidates waiting, he returns to his chair in the interview room and continues reading his last unfinished magazine. If there are no unfinished magazines, he starts reading a new magazine. After he finishes reading one full magazine, he goes to sleep.
Each candidate, when he arrives, looks to see what the interviewer is doing. If the interviewer is reading a magazine, the candidate waits for the interviewer to finish reading the current page of the magazine. Then the candidate enters the interview room and asks the interviewer to interview him. If the interviewer is sleeping, the candidate wakes him up and then asks the interviewer to interview him. If the interviewer is interviewing another candidate, the candidate goes to the waiting room. If there is a free chair in the waiting room, the candidate sits in it and waits his turn. If there is no free chair, then the candidate leaves.
Based on a naive analysis, the above description should ensure that the walk-ininterview functions correctly, with the interviewer interviewing any candidate who arrives until there are no more candidates, and then reading magazines and/or sleeping until the next candidate arrives. In practice, there are a number of problems that can occur that are illustrative of general scheduling problems. Please discuss those problems and provide an algorithm to solve those problems.
Note: There are two doors between the interview room and the waiting room. Tip: Read literature on the Dining Philosophers problem
Satyaaki and Yudhistra’s problem
Imagine that two divisions of the Pandava army are camped outside an enemy camp of Kauravas commanded by Bhishma. Each division is commanded by its own general; Saatyaki and Yudhishtra. The two generals can communicate with one another only by messengers, who might get caught by the Kauravas. After observing the Kaurava camp, Saatyaki and Yudhistra must each decide independently whether to attack the Kauravas or not. Then they must each communicate their plan to the other through messengers. Upon receiving a message from the other, both Saatyaki and Yudhistra must decide a common plan of action. The Pandavas can succeed only when both Saatyaki and Yudhishtra attack the Kaurava camp at the same time.

Read Solution (Total 0)

TCS Other Question

write an email to a restaurant owner,complaining about the bad service you had at his restaurant. puzzle on apitude.