• Post Reply Bookmark Topic Watch Topic
  • New Topic

Interview Question  RSS feed

 
srikanth darbha
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an interview question:

I have a round table having 10 people and i have a file containing some 500 questions and each question is of a single line and each person should be getting 5 questions and they should be selected randomly and should not be repeated,initially the person gets 1 question and if he completes the 1 question he gets second question and like this he gets total 5 questions so the person who completes all the 5 questions is declared as winner.so can you guys please help me out how to design this logic.please use the normal core java logic to do it.


Regards,

D.Srikanth
 
Campbell Ritchie
Marshal
Posts: 56541
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And how did you answer the question? We do not simply hand out answers, but will help if you show use what you have already achieved.
 
srikanth darbha
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am not asking for ready made solutions ,i was not able to answer this question because i was not getting an idea of how to do,so please give me an idea i do not want code i want what can be the design to do this .
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Turn off you computer.
Get a lot of paper, some pencils, and an eraser.
Write down how YOU would do this if you were literally standing in a room and had the situation you describe.
Write down every step you would take, what you would physically do, what you would need to keep track of, and what you would write down.
Once you have that done, go back and revise it, breaking down each item into simpler steps.
repeat the above line 2-3 times.
Hand the list to a 10 year old child and see if they can follow your directions without having any questions. If they do, revise the list and try again.

Once the child can follow your directions, you can start thinking about writing code.


a few other tips...

Break down the problem into something simpler. for example, maybe you only have 2 people at the table. Maybe they only have to answer one questions. Do that to figure out some of the initial steps.

Once you have some of those, code them in pieces. do NOT try and write the entire program at once. For a problem like this, i could easily see myself doing the write-compile-correct-test-debug cycle a few thousand times. Literally.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!