Honeywell Interview Question for Developer Program Engineers
- 0of 0 votes
Answerswrite 3 threads..2 producer threads and 1 consumer thread..
- sandeepkumar2116 August 22, 2015 in India
Two players playing a game. they can type 1 or 2. if player1 and player2 both type 2, both get 4 points each..if both
type 1 they get 2 point each..if player1 types 1 and player2 types 2, then player2 gets 3 and player1 gets 1..if player1
types 2 and player1 types 1, than player2 gets 1 and player1 gets 3..
There will be 10 rounds.And their scores would get accumulated. If at the end of any round, any player is trailing by more
than 6 points the trailing player would not get a chance to type any input in the next round. However, subsequent rounds onwards
all players would be given chance to type inputs should he/she does not trail by more than 6 points.
Thread1 & 2 : They are producer threads..they will ask the user to type something..But whenever a miss occurs for a player
(because he was trailing by more than 6 points), the respective thread will not ask the user to type anything.Instead it
will assume that trailing player has typed 2. The threads will write the inputs into a buffer..
Thread3 : the consumer thread will read from the buffer and display the values entered at each round and scores accumulated
at the end of each round..The scoring will happen in Thread3 only..
You can not use sleep or delay statement anywhere in the code| Report Duplicate | Flag | PURGE
Honeywell Developer Program Engineer
Interview Type: Written Test