• 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

javacaps mock exam

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
11. Which statements about garbage collection are true?
A) The garbage collector runs in low memory situations
B) You can run the garbage collector when ever you want.
C) When it runs, it releases the memory allocated by an object.
D) Garbage collector immediately runs when you set the references to null.
Answer 11:
A) The garbage collector runs in low memory situations
C) When it runs it releases the memory allocated by an object.
14. Select the correct form for anonymous inner class declaration ?
A) new Outer.new Inner
B) new Inner() {
C) new Inner()
D) Outer.new Inner()
Answer 14:
B) new Inner() {
21. Which of the following assignment statements is invalid?
A) long l = 698.65;
B) float f = 55.8;
C) double d = 0x45876;
D) All of the above
Answer 21:
A) long l = 698.65;
B) float f = 55.8;
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
shabbir,
Are you having problems with the answers?
I suppose so unless you are just showing us your Java skills ...
All given answers seem to be correct to me...
11: Garbage collection will be kicked off when there is danger of running out of memory. And it releases memory from objects that no longer have references to them.
14: Badly worded question and terrible answer definitions. But given that one of them must be correct then B would have to be it. To be completely correct we need B to be:
new Inner() { }
21: No problem. Any number literal that contains a decimal point in Java is considered a double. A double can only be assigned to a double without casting. Therefore, A and B are invalid because no casting was performed! C is valid because the literal octal value in Java is considered an integer and an integer can always be assigned to a double.
Regards,
Manfred.
 
reply
    Bookmark Topic Watch Topic
  • New Topic