This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exam 7, Q19,Q30 Dan Chisholm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exam 7, Q19,Q30 Dan Chisholm " Watch "Exam 7, Q19,Q30 Dan Chisholm " New topic
Author

Exam 7, Q19,Q30 Dan Chisholm

Dan Culache
Ranch Hand

Joined: Jan 24, 2003
Posts: 70
Question 30
Which of these classes declares the removeEldestEntry method?
Which of these classes declares the removeEldestEntry method?
a. LinkedHashSet
b. LinkedHashMap
c. LinkedList
d. TreeMap
e. TreeSet
f. HashMap
g. HashSet
h. Hashtable
i. None of the above

Question 19
class L{
public static void main (String[] args) {
StringBuffer s1 = new StringBuffer();
s1.ensureCapacity(16);
s1.append("ABCDEFG");
s1.setLength(5);
System.out.print(s1 + "," + s1.capacity());
}
}
What is the result of attempting to compile and run the program?
Are there questions that go into this level of implementation detail in the real exam?
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
The 1.4 version of the exam covers two new collections classes--LinkedHashMap and LinkedHashSet. One of the features that differentiates a LinkedHashMap from the older HashMap is the addition of the removeEldestEntry method. If you know that a LinkedHashMap is a good choice for the implementation of a cache then you would also know that LinkedHashMap declares a removeEldestEntry method.
The exam does not require memorization of the APIs for the collections classes. Instead, it requires you to select the best Collection implementation for a particular application. In this case, the removeEldestEntry method is the unique feature that makes the LinkedHashMap a good choice for use as a cache.
Having said the above, the real exam would be more likely to ask which class is the best choice for the implementation of a cache.
If Kathy or Bert reads this thread, then it would interesting to see if they would like to comment on how the real exam covers the two new collections classes.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
The real exam does require familiarity with the methods of the String and StringBuffer classes. Furthermore, the real exam will contain trick questions in which an attempt is made to invoke a StringBuffer method on a String object.
Dan Culache
Ranch Hand

Joined: Jan 24, 2003
Posts: 70
Ok, I've got it. I'll get into that as well.
Thanks Dan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exam 7, Q19,Q30 Dan Chisholm