• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exam 7, Q19,Q30 Dan Chisholm

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I've got it. I'll get into that as well.
Thanks Dan
 
No thanks. We have all the government we need. This tiny ad would like you to leave now:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic