loop
posted 23 years ago
Got confused with the code..
Why is the output 8???
Chitra
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Got confused with the code..
Why is the output 8???
Chitra
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi,
Inserting some System.out.prinln will help
Inserting some System.out.prinln will help
Whatever doesn't kill us ...<br />Is probably circling back for another try.<br />SCJP 1.4
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi Gururs:
Is not unrealistic that such a tidious question is expected to be answered in exam in 2 minutes?
Or it is not a exam like question?
Is not unrealistic that such a tidious question is expected to be answered in exam in 2 minutes?
Or it is not a exam like question?
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Those kind of questions are not to be expected in the real exam but they are d**n good exercises for learning how to analyze code. If the exam pops up a loooooong code snippet like this one, just remember that there is a trick somewhere, that the loop only executes one or two times due to some obscure condition and the whole analysis gets easier. Do not be impressed by the length of the code, but learn how to decipher it quickly and efficiently. That way you may gain minutes instead of losing them 

Chitra Jay
Ranch Hand
Posts: 76
posted 23 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
This question was from JQ+ Real Brainer section. But,the actual for loop was
for (int i=10; i<0; i--) instead of the one i posted.So the whole for loop never gets executed at all.
But,I purposely wanted to make the loop condition evaluate to true and find out what the program really does..
I too spent a lot of minutes on this one..Hope such tough ones doesnt appear in the real exam
Valentin,Thanks for your tip!!
Chitra
for (int i=10; i<0; i--) instead of the one i posted.So the whole for loop never gets executed at all.
But,I purposely wanted to make the loop condition evaluate to true and find out what the program really does..
I too spent a lot of minutes on this one..Hope such tough ones doesnt appear in the real exam
Valentin,Thanks for your tip!!
Chitra
| No more fooling around. Read this tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |








