Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MindQ Mock Exam Errors

 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I took the MindQ Mock Exam on your site, but found myself disagreeing with three of the answers given in the answer key.
Question 33: The answers given are a, b, and e. But d is also correct, because it is always legal to declare unchecked exceptions such as ArithmeticException even if the method you're overriding hasn't done so.
Question 34: The answer given is a. It should be b, because "super" is a keyword that cannot be used as an identifier.
Question 36: The answer given is b(1). It should be a(0) because string literals are never garbage-collected. The answer given would be correct if the example were changed to:

String name;
String newName = new String("Nick");
newName = new String("Jason");
name = new String("Frieda");
String newestName = name;
name = null;
//Line A
 
Anselme Bender
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ron,
I found the following at this address http://mindprod.com/jglossinterned.html where there is a lot of interesting informations
---------------------------------
Intern and garbage Collection
---------------------------------
In the early JDKs, any string you interned could never be garbage collected because the JVM had to keep a reference to in its Hashtable so it could check each incoming string to see if it already had it in the pool. With JDK 1.3 came weak references. Now unused intered strings will be garbage collected.
Hope this help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic