• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Errors in the K&B bonus exam?

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Has anyone else encountered errors in the K&B bonus exam?

I was taking the open book exam, and one questions was creating three long two dimensional arrays, and playing with the elements. The correct answer was D, with the explanation of:

D) compilation error at line 5

D is correct. It is a legal way to create an array of four integers, name 'array'.

There is no 4 dimensional array, and there is no array named 'array'. Also if it is a correct way of creating this array, then compilation error at line 5 is not correct either.

Thanks for your input.

Tim Rawerts
 
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,Tim.

the open book exam? how many questions you do ? the default number of questions are 65 right?

and why dont you type the whole question here for members here to take a look....

i also wonder what were you talking about...

thanks.
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your first two questions make no sense, but here is the question in it's entirety.

public Test{
public static void main(String [] args}
long [][] a1;
long []a2[];
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your first two questions make no sense, but here is the question in it's entirety.

public Test{
public static void main(String [] args)
long [][] a1;
long []a2[];
a2 = new long[3][];
a1 = a2;
System.out.println(a1[1][0]);
}
}



a) 0
b) null
c) compilation error at line 5
d) compilation error at line 6
e) compilaiton error at line 7
f) runtime exeception is thrown at runtime


I chose f. Here is the answer I was given

D is correct. It is a legal way to create an array of four integers, named 'array'.

A,B,C,E,F ar invalid attempts to declare and initialize an array, none of them will compile.
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The correct code that compiles is :-

public class Test{
public static void main(String [] args)
{
long [][] a1;
long []a2[];
a2 = new long[3][];
a1 = a2;
System.out.println(a1[1][0]);
}
}

It produces the putput :-

java Test
Exception in thread "main" java.lang.NullPointerException
at Test.main(Test.java:8)
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, I think people are missing the point. I am not looking for the correct answer, but rather has anyone else found errors in the sample exams?

Tim Rawerts
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your demand is confusing me.
 
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

I spotted a couple of questions with wrong answers while attempting the K&B's MasterExam mocks. I agree with you the answer should be f.

Joyce
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Joyce. That is twice now you have helped me out, and I appreciate it.

Tim Rawerts
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim -

I'm jamming on the 1.5 update right now, so I don't have time to research this, but I think if you go to the Osborne site there is an errata that talks about this error - not sure, just kind of rings a bell. In general, I think the practice exams are very clean - maybe only one or two errors - again this is just what I recall.

HTH,

Bert
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bert. I think it is way cool that you post here. The book is tremendous, and I have not doubts I will pass the exam tomorrow morning.

Tim Rawerts
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I give test on Saturday morning.

all the best to both of us....

hope to hear your result. i'm sure you can pass it easily.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I remember coming across this buggy question a couple of times when I was doing the practive exams last week...
 
reply
    Bookmark Topic Watch Topic
  • New Topic