• 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

Possible error in Master Exam...

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

Their answer is compiler error at line 4. I do not see why (same dimensions). My answer was null pointer exception, trying to access a1[1][0] without being initialized.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you are correct. I cannot see any reason why the compiler should complain on line 4.
-Vicky
 
Ranch Hand
Posts: 34
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let's Java respond to this :

As (Test.java:8) correspond to your line 5, your answer seems to be right.
[ July 26, 2003: Message edited by: Francois Roland ]
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andres -
This could be scary...
On my master copy the answer is:
F - an exception is thrown at runtime
Can you tell me where you are seeing a different answer?
Thanks!
Bert
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bert Bates:

Can you tell me where you are seeing a different answer?


Master exam II. I searched again and this is the complete question and and answer.

What is the result?
A. 0
B. null
C. Compiler error line 5
D. Compiler error line 6
E. Compiler error line 7
F. An exception is thrown at runtime
But the weird thing is the answer:


D is correct. It is a legal way to create an array of four integers, named 'array'.
A,B,C,E, and F are invalid attemps to declare and intialize an array, none of them will compile


I was really surprised when I read the answer. Where's the array named 'array'? The second statement doesn't make sense either. I wonder if I'm the only one who got this error.
BTW, I got 88% and 81% in master exam 1 and 2. What does your experience tell you with these scores ?
cheers
 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

BTW, I got 88% and 81% in master exam 1 and 2. What does your experience tell you with these scores ?


That you will ace the test
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic