Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Marcus Green's Mock Exam 1 Question.

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
Following question is asked in Marcus Exam.

Answer
Compilation and output of BillKathyCarl

Now just wanted to know that will such questions be there in real exam too ? becoz as far as I know we are supposed to know which is the best interface to select for particular situations. Now the above question requires you to know the methods like
tm.put("a","Bill"); &
tm.keySet().iterator();
So we should know these basic methods too ?? what else is required to be known ??
Thanks in advance.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i too took the Marcus Exam yesterday and got 90% in that.
I also encountered the same question and after some thought i got it right .
Well u should know the basic methods such as put, get , iterator, etc.
But the keyset() method was a bit hard if u have read the K&B book. I figured out that since the TreeSet is sorted by natural order, using keyset().iterator() wud cause the iteration to be in natural order of the keys. Since the keys represent String the natural order wud be alphabetical.
Still i m also a bit confused about whether i shud study the API for Collections Framework or not. i will be taking my exam next week so its an area of concern for me.
Hope Bert & Kathy clearify this
 
arch rival
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer I have given is as follows.
"Compilation and output of BillKathyCarl
The TreeMap class stores the keys rather than the values in sorted order"
I am not certain exactly how much depth you are expected to know on the methods and uses of the collection classes, but I know you need to know which classes cause elements to be unordered, ordered and which sorted, and that is at the heart of this question.
 
Vishy Karl
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all for your replies.
Bye
 
Ruth Stout was famous for gardening naked. Just like this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic