• 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

answers to java.ditmas.net Mock Exam

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did the mock exam provided by http://java.ditmas.net/mocks.htm. Does anyone know where are the updated (corrected) answers to the mock exam? Some of the answers seem to be not right. Or maybe I am wrong.
Thanks!
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Moya
Just to let you know there are some incorrect answers on that site from what I remember when I did the SCJP
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For #43 i have a question
43. What will be the return type of this statement?
(byte)10/10.2*7;
A. short
B. int
C. double
D. float
E. Compilation Error
My question is,the priority of the cast operator, what is actually being casted into byte?
TIA
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It returns a double (see http://java.sun.com/docs/books/tutorial/java/nutsandbolts/expressions.html for a summary of operator precedence) as the cast is evaluated before the / and *
 
chafule razgul
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Curly
FYI, questions 50 and 55 have incorrect answers, in my opinion, after trying them out.. Question 32 has options A-D, but the answer is E..
 
Ranch Hand
Posts: 38
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree
#50 - C: Exception is a subclass of Throwable - not Thread as they seem to think
#55 - Given:

How will you create an instance of static Inner Class? Select 2
a. Inner a= new Inner();
b. Outer o= new Outer();Outer.Inner a= new o.Inner();
c. Outer.Inner a= new Outer.new Inner();
d. Outer.Inner a= new Outer.Inner();

they say B & D.. I would have said B for sure.. when run in the main() but does D work?
# 32 - yeah well.. nice answer! no option E.. I'm about to give up on this test I think.. though good practice! but just to check I've got it

What will be the output?
A. Compilation Error void main Can't return any value.
B. Prints Exception
C. Prints Exception Finally
D. Prints Finally

answer is A right?
PS. can you see the question numbers for the answers? I've had to copy it into a spreadsheet to see them...
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

#55 - Given:

How will you create an instance of static Inner Class? Select 2
a. Inner a= new Inner();
b. Outer o= new Outer();Outer.Inner a= new o.Inner();
c. Outer.Inner a= new Outer.new Inner();
d. Outer.Inner a= new Outer.Inner();

they say B & D.. I would have said B for sure.. when run in the main() but does D work?


Rule: A static member/nested class reference does not need an instance of the enclosing class!
According to this D is ok, B is right although it uses an instance of the Outer class.
Erik Dark
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For #32 correct answer is D.
Are you guys all talking about the same test?, i.e the one at:-
http://java.ditmas.net/mocks.htm
I will make sure I do not go to this web site when I am ready to take mock exams.
Thanks,
Brian
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


#55 - Given code:
class Outer{
static class Inner{}
}
How will you create an instance of static Inner Class? Select 2
a. Inner a= new Inner();
b. Outer o= new Outer();Outer.Inner a= new o.Inner();
c. Outer.Inner a= new Outer.new Inner();
d. Outer.Inner a= new Outer.Inner();
they say B & D.. I would have said B for sure.. when run in the main() but does D work?


Just tried choice b: it makes compiler complain about no package o. But if you change "a = new o.Inner()" to "a = o.new Inner()", then no compiler error at all! :roll:
 
reply
    Bookmark Topic Watch Topic
  • New Topic