File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New Collections Exam

 
Dan Chisholm
Ranch Hand
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just uploaded a beta version of a new exam covering the Java Collections Framework. Currently, there are 15 questions. I will be adding more soon.
Please use the following URL to access the exam.
http://www.danchisholm.net/beta/collections.html
Unlike previous versions of my exam, this collections exam does not have any code examples. For that reason, the answers to the questions allow for more debate than questions that include a program that produces only one correct answer. I assume that the new exam will be the source of lively debate on this message board.
The home page for my exam does not include a link to the beta version of the collections exam. It can only be accessed using the above link. I am making the new exam available only to users of this board because I would like any debate on the questions to take place here.

Please open both the question and answer pages and keep both open as long as you are taking the exam or save both pages on your machine. I might upload a new version of the exam at any time so the answer page that matches the exam that you are taking could disappear at any time.

Please try the beta exam at the above URL and let us ranchers know what you think.
[ August 28, 2002: Message edited by: Dan Chisholm ]
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just uploaded a second Collections exam containing an additional 10 questions. This second exam contains questions that focus on the hierarchy of the classes and interfaces within the Java Collections Framework. The URL is the same as posted in the previous message.
Please give it a try and let me know what you think.
 
zarina mohammad
Ranch Hand
Posts: 104
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried both Exam A and B. i found them simple and good.
 
zarina mohammad
Ranch Hand
Posts: 104
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where can i find more detailed explanation of answers of 12 and 13 in Exam A
Given an application that may be implemented using either an ArrayList or a Vector which of the two is preferred?
Given an application that may be implemented using either an HashMap or a Hashtable which of the two is preferred?

thanks
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by zarina mohammad:
where can i find more detailed explanation of answers of 12 and 13 in Exam A
The reason is because Hashtable and Vector are both synchronized which means they will run slower. If you don't need them to be synchoronized then you shouldn't use them.
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zarina,
Thank you for your comments. I appreciate the feedback.
The Hashtable and Vector classes were introduced with Java 1.0. The Collections Framework was introduced with Java 1.2. With the introduction of the Collections Framework the Hashtable class has been upgraded to support the Map interface. Similarly, the Vector class was upgraded to support the List interface.
As a general guideline of Object Oriented Programming it is better to write code to an interface (e.g. Map and List) rather than to an implementation such as Hashtable and Vector. Both Vector and ArrayList implement the List interface so which is preferred? If you want a collection with unsynchronized methods then you must select ArrayList and not Vector. If you need synchronization then you may use a Vector or you can use the Collections.synchronizedList method to get a synchronized view of an ArrayList. The ArrayList satisfies both requirements but a Vector only satisfies one.
The Vector and Hashtable classes provide backward compatibility for applications that were written before the introduction of the Java Collections Framework with Java 1.2. There is no need to use Vector and Hashtable in new designs. Instead, the code could be simplified by using only the classes and interfaces of the new Java Collections Framework.
Having said the above, I now realize that the questions may appear to be more religious than practical so I will remove them when I upload a new version.
Thank you,
Dan
 
zarina mohammad
Ranch Hand
Posts: 104
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks thomas and dan that was certainly a detailed explanation.
 
Niral Trivedi
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dan,
Can you post exam on Assertions on your mock Exam??
I really like your mock exams and i always keep checking for new questions.. I will appreciate if you can post something related to Assertion.
Thanks a bunch in advance.
Niral
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Niral Trivedi:
Hi Dan,
Can you post exam on Assertions on your mock Exam??
I really like your mock exams and i always keep checking for new questions.. I will appreciate if you can post something related to Assertion.
Thanks a bunch in advance.
Niral

Niral,
I will start working on assertions next week.
Thank you for asking.
 
Niral Trivedi
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Dan..
Looking forward to it..
Niral
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just uploaded a new beta exam for hashcodes. At this time, there are only seven questions.
Please give it a try at the following URL.
http://www.danchisholm.net/beta/collections.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic