aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Mock question on enhanced for Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Mock question on enhanced for" Watch "Mock question on enhanced for" New topic
Author

Mock question on enhanced for

Dariusz Kordonski
Ranch Hand

Joined: Jul 11, 2008
Posts: 49
I came across a mock question for SCJP 1.5 from JavaBeat Mock exams ('Language features', Q6):
'Which of the following statements are true about the new enhanced for loop?'
One of the answers is:
'The enhanced for loop eliminates the need for Iterator objects'.
And it is said to be one of correct choices. Now I would argue that the need for iterators is not eliminated entirely with introduction of the enhanced for - e.g. let's take code scenarios, when we have to remove objects from collection during iteration. It is not possible (or at least not safe) using the enhanced for.

Do you agree that such formulation is at least a bit ambiguous? Can I expect this kind of questions / answer choices at the real SCJP?
Jamie MacDonald
Greenhorn

Joined: May 17, 2008
Posts: 20
Hmmm...well technically the statement is true because it is true in some cases, but you are right--it is poorly worded. Trying to apply a programmer's need for precision to the English language is always fraught with peril.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Mock question on enhanced for
 
Similar Threads
Passed SCJP 6
Number of choices for a question (SCJP 5.0)
SCJP
scjp
SCJP minimumlevel = new SCJP();