Answer:
250 lines of code.
Asked In: Many Interviews |
Alert Moderator
Posted by:
Paulkm
on: 10/14/2009
The answer of 250 I believe is incorrect. And heres the logic reasoning behind why I think it is correct.
1. The question is how many lines of code he WILL complete in 1 hour i.e 60 minutes.
2. He thinks he can generate 100 lines of code in 5 minutes but this is completely irrelervant. The question clearly states in 1. How many lines WILL he complete.
3. Thus, he can type 100 lines of code in 10 minutes but THEN rests for 5mins. THUS his true output is 100 lines every 15 min.
4. Answer is 60 /15 * 100 = 400.
Now I believe the question also may be subject to interpretation possibly due to unclear english grammer. What do I mean by this?
STATEMENT: "A software engineer has the capability of thinking 100 lines of code in five minutes". In other words, he thinks about 100 lines of code for 5 minutes then TYPES 100 lines of code in 10 min THEN has a break for 5min. Thus his true output is 100 lines every 20min.
THUS Answer is 60 / 20 * 100 = 300 lines.
Please note, A good aptitude test answer should be always backed up by concise logic reasoning. If the answer is 250 lines in 1 hour then I will stand corrected if someone can show the logic behind that answer.
Cheers
Paul
Hi Paul,
It is very important that When Someone go for the Aptitude question, it should be read properly and read twice and I am sorry to say but you fail to understand the question. The answer 250 lines is correct and I will explain you why.
The question clearly says "He takes a break for five minutes after every ten minutes. " Unfortunately you missed this part.
Now here is the explaination :
For 5 five min he thinks, Next five mins he write code then takes a break. So for the first 15 mins he writes 50 lines of code.
After the 5 min break, he again starts writing code for next five minute. For next five min, he again starts thinking. As it is 10 mins, so now he takes the break.
So in 30 Mins, he has written 100 lines of code.
Now for the next 10 mins, he writes the code. and then he takes a break for 5 mins.
So in 45 Mins, he has written 200 lines of code.
So now he again starts thinking for 5 mins. and in next five mins he writes 50 lines of code. As it's 10 mins now,so he takes a break now for 5 mins.
That's it. 1 hour is over and he has only written 250 lines of code.
Let me know, if you still can't understand this.
Thanks,
Virendra Dugar
Posted by:
Ezec
on: 10/17/2009
I agreed on he has written 200 lines of code after 45 mins, but then why do he spend 5 mins thinking? there are not enought time to write 100 lines of code.
let me try! our engineer takes a break for five minutes after every ten minutes, it minds he works 40 min/hours. we know he can write 100 lines in 15 mins. then,
15 min -----> 100 lines of code
40 min -----> 40 * 100 / 15 = 266 lines of codes
let me know what if you agree or not.
Posted by:
Paulkm
on: 10/18/2009
Virendra,
The last sentence should have read:
"When setting Mensa tests, they go to great lengths in assuring there is no ambiguity." -- corrected just in case the sentence gets interpretated differently ;-)
Hey Paul,
I didn't say that you are here to score points. But as you said, it can be interpreted in different ways. I still can not understand how it can be interpreted differently. The question is very clear and straight. I don't know why you are interpreting it differently. As far as grammatical representation is concerned, I don't see any problem with this.
Thanks,
Virendra Dugar.
Posted by:
Paulkm
on: 10/18/2009
Hi Virendra,
Thank you for your post. Your reasoning is perfectly valid based on your interpretation of the grammer presented therein. However, there is the problem with the question; it can be interpreted in different ways to to it's grammatical presentation.
I did not fail to see "he takes a break after every ten minutes" - the problem is the statement is open to interpretation; i.e the person breaks for 5 minutes after every 10minutes of time elapsed or the person breaks for 5min after every 10 minutes. As this statement immediately follows the fact that he codes for 10 minutes, grammatically it can imply that the 10 minutes in the subsequent statement if refering to this very 10 minute period.
It's a little harsh trying to "up the ante" by saying I failed to read the question. My point is the fact due to it's grammatical presentation, the question is subject to interpretation. This is why I showed 2 logical reasonings for my answer. In your eyes both are incorrect based on your interpretation of the question.
`Just to throw an example of interpretation, I'll raise some different apptitude questions:
"I have a analogue clock and the time on the clock says 6:15. How many degrees are between the short hand and the long hand?" What would your answer be?
And another:
I have some matchsticks that are used to make 2 squares that are joined side by side so that 7 matchsticks make 2 squares. How many matchsticks does it take to make 100 squares? What would your answer be?
I'm not looking to score points here, I'm merely trying to demonstrate that when an aptitude question gets set, it has to be clear and concise otherwise it will be subject to interpretation. When sitting Mensa tests, they go to great lengths in assuring there is no abiguity.
Regards
Paul
Posted by:
Paulkm
on: 10/19/2009
Virendra,
I think we are going to have to agree to disagree on this point.
For the record, I have shown the question to 3 of the best programmers (not that it means coders have the best "out of the box" skills ;-) ) and 2 certified intellectuals (MENSA scores > 148). No one has arrived at a result of 250 as yet. In fact, one of the MENSA people came to the same conclusion as I in that the wording of the question can be interpreted in different ways:
For example:
"A software engineer has the capability of thinking 100 lines of code in five minutes and can type 100 lines of code in 10 minutes"
As mentioned previously, there is no mention that he does these 2 tasks one after the other as shown by your workings. If however that statement had said:
A software engineer has the capability of thinking 100 lines of code in five minutes and then types 100 lines of code in 10 minutes then I would concur undisputedly with your first part of logical reasoning.
Problem is, it does not. It can equally be plausible that the coder is thinking about 100 lines of code exactly at the same time as typing 100 lines of code. There are not many single tasking coders in the market place who are in work ;-) If they are they are lucky.
Another ambiguous point is:
"and can type 100 lines of code in 10 minutes. He takes a break for five minutes after every ten minutes."
You have chosen to interpret this as "irrespective of what the coder is doing, he takes a break for five minutes after every TEN Minutes" If the question had explicitly said this then I would undisputedly concur with you.
But TEN minutes of what? 10 minutes of coding or 10 minutes of time elapsed irrespective of what the coder is doing? It's ambiguous. As such, ambiguity leads to different postulations.
For the record, We sometimes set technical questions for candidates with such ambiguity just to test to see if they are thinking about different scenarios of approaching problems and that they are thinking "outside the box". I have enjoyed discussing this question with you. It has stimulated me to use this example in future tests to see what response it illicits.
Best Wishes
Paul
Posted by:
Paulkm
on: 10/20/2009
Virenda,
Once again thanks for your reply. I'm going to make this my last post on the matter as it is very clear you have one answer and only one answer in mind. In other words either people agree with your answer or that they have failed to see your interpretation and are as thus wrong.
There is no test of skill here to reach an exact answer because the question is ambiguous. I have gone to great lengths to show where the ambiguity lies. If you don't want to see it then that is your prerogative.
I fully respect you wanting to defend your standpoint and your answer and like I said, there is nothing wrong with your answer based on how you interpret the question. However, sometimes it is good for the soul for one to stand back and try to look at the situation from the other persons perspective. This leads to a better understanding of problems and actually better co-operation amongst parties.
I will leave you with the aptitude question I posed earlier as I'd be interested in how you tackle such a question.
I have some matchsticks that are used to make 2 squares that are joined side by side so that 7 matchsticks make 2 squares. How many matchsticks does it take to make 100 squares? What would your answer be?
As always, it's been a pleasure debating this with you.
Best Wishes
Paul
Hi Paul,
Thanks for your inputs.
Paul : A software engineer has the capability of thinking 100 lines of code in five minutes and then types 100 lines of code in 10 minutes ", If the question is formed like this, it becomes very easy for anyone to solve it.
Problem is, it does not. It can equally be plausible that the coder is thinking about 100 lines of code exactly at the same time as typing 100 lines of code. There are not many single tasking coders in the market place who are in work ;-) If they are they are lucky.
I am not looking at the real world programmer's skills to have answer of this question. Not every programmer can write 100 lines of code in 10 mins. So this has nothing to do with the real world programmers.
Paul :Another ambiguous point is:
"and can type 100 lines of code in 10 minutes. He takes a break for five minutes after every ten minutes."
You have chosen to interpret this as "irrespective of what the coder is doing, he takes a break for five minutes after every TEN Minutes" If the question had explicitly said this then I would undisputedly concur with you.
But TEN minutes of what? 10 minutes of coding or 10 minutes of time elapsed irrespective of what the coder is doing? It's ambiguous. As such, ambiguity leads to different postulations.
In the question, there are only 3 activities mentioned which are thinking, coding and taking break. He is taking breaks either after doing coding or after thinking.
Paul, If the question is formed in such as easy manner, it's not going to test the skill of the person. He has to be made think.
Thanks,
Virenda Dugar
Hiii virendra
Plz give me the reference for the answer of this problem.
After 45 min he/her complete writing 200 loc.
but there is some problem for remaining 15 min.
if u have capable to solve this problem then plz elaborate.