• 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

New SCJP mock exam

 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Corey McGlone:

Well, I scored about a 70% on it and I'm planning on taking the real exam tomorrow. I'll let you know how I think the two compare after the exam.
Corey


Okay, so on Val's exam, I scored just below 70% (I think it was 69.something%). That;s about 41 out of 59 (I don't remember exactly what my score was.)
On the real exam, I scored 88%. That's 52 out of 59.
So, for me, I got about 10 more right on the real exam than on Val's. I did little studying between taking the two, but I suppose Val's exam helped me out in itself.
So, let it be known, Val made a hard test! Thanks, Val.
Corey
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me be the first (in this thread anyway)
to say "Congratulations Corey!"
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm number two!!!
Good job Corey.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thread-hijacking is frowned upon...
Corey has opened a thread where he can be congratulated, there it is :Tally up one more certified programmer....
 
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
Well, a big "Congratulations" to Valentin too for a very hard mock exam
I would have to say it is harder than mr. Bill Brodgen's hardest question collection
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for a very hard mock exam
That was intentional
I would have to say it is harder than mr. Bill Brodgen's hardest question collection That was not intentional
 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great work Valentin!!!
I especially like the idea of including relevant JLS sections in the answer explanations. I haven't solved the test yet, but noticed this in the answer of the first question -
The answer -
Variable z is not declared, thus, z cannot be resolved on lines 2 and 3. In C/C++, the statement on line 2 is valid and has the effect of declaring two integer variables x and z. In Java, however, z cannot be declared that way. In order to get this code to compile, we have to write either:
int z=1,x=z;
or
int z=1;
int x=z;
or
int z=1;
int x=1;
The statement on line 2 -
int x=z=1;//line 2
is invalid in C++ as well, as variable z is not declared, and the c++ compiler rightly cribs abt it. I have tested it on my VC compiler and I believe even gcc would flag it as an error.
Let me know,
- Manish
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Manish. I really appreciate. I'm going to fix that right now.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question 38
public class Question38 {
public static void main(String[] args){
while(false);//line 1
if(false);//line 2
do{}while(false);//line 3
for(;false ;//line 4
}
}
It does compile and run fine, but the anwswer is "Compilation error on lines 1 and 4.".
Is it correct?
Thank you
Ben
 
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Val,
I am really confused about Q38, accoding to JLS 14.20, line 1 & 4 should be unreachable statements.
But when I compiles the code, compiler does not show any error, Is this version dependent ?
my java version is
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
please advise
thanks
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When in doubt, the JLS rules.
JLS 14.20 Unreachable Statements
 
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
for Question58 is option E meant to be blank?
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it is not, I've had some problems with my mock generator lately and that may be the reason. I've fixed the problem now... Thank you chafule.
 
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
With question 38 i have no problems compiling it with my jdk1.3.0 compiler..
which makes me wonder: which versio of JDK are we supposed to assume that the actual exam is based on?
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know that some compilers are accepting Question38's code. But as per the JLS that code should not compile. The version you should assume is JDK 1.2. And if in doubt the JLS rules, and it says that Question38's code does not compile.
Personally, I'm using JDK 1.4 and it does not accept that code. Maybe JDK 1.3 compiler was built to be more permissive and has been corrected in JDK 1.4 again to be in accordance with the spec.
[ March 05, 2002: Message edited by: Valentin Crettaz ]
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, if you write this:

while(false);
It will compile. There are no unreachable statements, because there are no statements in the while loop.
if you write:
while(false){
int i = 5; //line 1
}
Now you have created an unreachable statement. The compiler will complain that line 1 is unreachable.
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob note the semicolon ';' after the while(false)...
';' is an valid empty statement so the code should not compile.
while(false); is equivalent to
while(false){
;
}
[ March 05, 2002: Message edited by: Valentin Crettaz ]
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi val,
is this a worst case scenario,hope it is!


thanks.


i scored:
Your score: 67.8%
so is there hope for me.
[ March 09, 2002: Message edited by: aymen esawey ]
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right... In fact I did write "once" and then changed it to twice a while back but I just can't remember why...
I've fixed it.Thanks for your feedback
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you know, jdk1.4 is stricter on unreachable statements than 1.3!
This compiles under 1.3:
while(false){ }
for(;false ; ) { }
Because there are no statements, there are thus no unreachable statements.
However, you now get a "unreachable statement" error under 1.4.
[ March 09, 2002: Message edited by: Rob Ross ]
 
aymen esawey
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
val this is a great mock,really
reading the explanations to the questions i got right carved the hunches i had into facts,and added alot. thanks a (Float.MAX_VALUE).
i would like to verify Q4 wording:


A. The garbage collection thread cannot outlive a user thread.
C. The garbage collection thread is not a non-deamon thread.


as these answers are confusing,i know that gc thread can't outlive ALL user threads.
and
"is not a non-daemon thread"===>!(!(true))==>>true(or so i thought)
so easier wording would help more.
awaiting clarifications.
thanks again.
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rob,
when answering questions, the only "thing" that rules is the JLS and not the different Java versions. Accoring to the JLS, those statemetns DO NOT compile.
Moreover, note that in:
while(false);
for(;false ; ) ;
there is a semicolon (';') after the while and for, and a semicolon is considered as an empty statement. So there is a statement after all, even an empty one can be unreachable !
[ March 10, 2002: Message edited by: Valentin Crettaz ]
 
aymen esawey
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what i wanted to say is:
gc can outlive a user thread,so (A) is wrong.
and gc is a daemon thread so (C) is right.


A. The garbage collection thread cannot outlive a user thread.
C. The garbage collection thread is not a non-deamon thread.
as these answers are confusing,i know that gc thread can't outlive ALL user threads.
and
"is not a non-daemon thread"===>!(!(true))==>>true(or so i thought)


so gc can outlive a user thread,but not all user threads.
and not a non-human is a human?!!!.
correct me if am wrong ,i 'm not asking for a change in the wording ,i think the answers are wrong.!!!
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sorry aymen
You are right... I've fixed the wording of answers A and C. Thank you very much for your feedback.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Exam in a couple of days....
Just going through Val's mock, Excellent workout, really puts you through your paces...
Just A quick typo I think has been overlooked,
In Q23 the answers are A and D, however in the notes with the answer it states

Moreover, the main() method is just another static method, and thus, it can't be hidden.


The typo: should be "can" instead of "can't"
regards,
Sam.
PS great site, keep up all the good work!!
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your feedback Sam, I'll fix it right now.
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What an exam !!!
Well I have to make a few confessions
1) I did take it at 1.30 am in the night (I hadn't read Rob's post then), and it took me 2 hrs 5 mins to complete it. Did you guys manage to complete it in less than 2 hrs?
2) I appeared for it w/o revising postfix operator, operator precedence and similar things.
I scored only 71% (42 out of 59), and I was quite scared, but now after reading Corey McGlone's post, and knowing that he scored 88% in the real thing, I think it's OK! I have some future after all.
Now, the most important part -
I need suggestions
Most of the Qs that I got wrong are because of operator stuff (precedence, postfix etc) esp like Q48.
Do I need to get into the details of it now, especially when there are things like IO, Threads, Inner classes and traps to be revised. Is it safe assuming that Qs of this level of difficulty will not e asked on operators?
More annoyingly, I am loosing marks because of some very silly mistakes in other mocks as well, not because I do not know the concept. The questions are usually from diff topics, so it's not any specific area to revise. How can I minimize that? ( I know "Read question very carefully", anything else?) Because, I try to read question carefully and still manage to make mistake What can be done abt it?
Lastly, from point of view of the real exam what do I need to revise in the last few days? Something that I must do w/o fail?
Please DO give me some tips on this.
TIA,
- Manish
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I have to make a few confessions
1) I did take it at 1.30 am in the night (I hadn't read Rob's post then), and it took me 2 hrs 5 mins to complete it. Did you guys manage to complete it in less than 2 hrs?

The most important thing in this mock is to answer questions correctly and not to do it under 2 hours. That's why I did not include a timer, although the mock engine application I'm making right now does have a timer.
2) I appeared for it w/o revising postfix operator, operator precedence and similar things.
Your call
I scored only 71% (42 out of 59), and I was quite scared, but now after reading Corey McGlone's post, and knowing that he scored 88% in the real thing, I think it's OK! I have some future after all.
71% is pretty good actually for this level of difficulty.
Most of the Qs that I got wrong are because of operator stuff (precedence, postfix etc) esp like Q48. Do I need to get into the details of it now, especially when there are things like IO, Threads, Inner classes and traps to be revised.
Yes, operator precedence is very important since it can arise in any question type. Let's say the question is about Threads. You know Threads very well, of course, but there is a weird statement in the run method that involves an arithmetic expression composed of several operators (not as many as in Question 48). The question asks about the output of that expression. Then you are screwed if you know how the threads run but don't know how to resolve the arithmetic expression. This is just an example which may never arise, but who knows :roll:
Is it safe assuming that Qs of this level of difficulty will not e asked on operators?
At least not all questions will be that difficult, but some might be.
More annoyingly, I am loosing marks because of some very silly mistakes in other mocks as well, not because I do not know the concept. The questions are usually from diff topics, so it's not any specific area to revise. How can I minimize that? ( I know "Read question very carefully", anything else?) Because, I try to read question carefully and still manage to make mistake What can be done abt it?
Read question very carefully
Seriously, you must be able to be comfortable with any question even if it involves different objectives. Being able to solve anything is your duty as an engineer.
Lastly, from point of view of the real exam what do I need to revise in the last few days? Something that I must do w/o fail?
Maybe you could go over some notes if not already done... Jane's and Velmurugan's notes are pretty good actually.
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
resurrecting...
 
Goodbye moon men. Hello tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic