Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 08-19-2009, 12:57 PM   #1
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default So... you think you know Java?

The title says it all really. If you think you're good at Java, see how many of these you can get right and how many catch you out

If you don't class yourself as a good Java programmer, it's interesting stuff to find out anyway!

http://mikkle.co.uk/javaquiz
__________________

berry120 is offline   Reply With Quote
Old 08-20-2009, 11:07 PM   #2
In Runtime
 
TitanMATRIX's Avatar
 
Join Date: Jul 2009
Posts: 202
Send a message via MSN to TitanMATRIX
Default Re: So... you think you know Java?

No... no I don't think I know Java.
__________________

__________________
***Network Warrior***
TitanMATRIX is offline   Reply With Quote
Old 08-22-2009, 05:21 PM   #3
Guru
 
JogaBonito1502's Avatar
 
Join Date: Jan 2008
Location: U.S.
Posts: 7,841
Default Re: So... you think you know Java?

That was messed up. None of my fill-in-the-blank answers were evaluated. I'm pretty sure I got all of the output questions right. I've never programmed in Java, but it's similar enough to C++.
JogaBonito1502 is offline   Reply With Quote
Old 08-22-2009, 05:33 PM   #4
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: So... you think you know Java?

Quote:
I've never programmed in Java, but it's similar enough to C++.
I'm afraid this assumption is probably where you fell down...!

The quiz was designed to be the nit-picking, trick question type as a laugh more than anything. It's aimed at casual Java developers to prove that not everything is always as it seems, and perhaps teach a thing or two along the way.

I've got what I'm pretty sure are your set of answers here in front of me, and if so then I'm afraid all your answers were indeed evaluated... you just fell into most of the common traps!
berry120 is offline   Reply With Quote
Old 08-22-2009, 08:18 PM   #5
Guru
 
JogaBonito1502's Avatar
 
Join Date: Jan 2008
Location: U.S.
Posts: 7,841
Default Re: So... you think you know Java?

Oo..Wait...what were the traps? When the answer page came up, my fill in the blanks answers weren't listed...
JogaBonito1502 is offline   Reply With Quote
Old 08-23-2009, 07:32 AM   #6
j03
~~~~~~~~
 
Join Date: Jan 2005
Location: Wales
Posts: 5,556
Send a message via MSN to j03
Default Re: So... you think you know Java?

Errmm... I think that whoever wrote that quiz needs to take a "So... you think you know PHP?" style quiz. As JogaBonito said, None of my typed answers where read!
j03 is offline   Reply With Quote
Old 08-23-2009, 07:58 AM   #7
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: So... you think you know Java?

They're not always listed after you wrote the question - I think this might be a bug in the quiz module for drupal, but they're definitely evaluated.

To give you an example of one of the traps:

Code:
What does this output?

long num = 6l;
System.out.println(num);
The right hand digit is in fact not a 1, but an L. (It's less obvious using some fonts than others.) Judging by the date / time of the reports I've got and the date / time of your posts, it looks like Joga put 61, mistakenly thinking the lower case L was a 1 (that's the most common trap!) and j03 put error, picking up that it was an L but assuming the compiler would complain (second most common trap.)

In fact, putting an L after a number in Java denotes that this number is of type long, not of type integer. If you type:

long num = 2147483649;

...then you'll get an error, because Java evaluates the thing on the right as an int rather than a long, and complains it's too big. You'd need:

long num = 2147483649L;

...before it'd work. Of course in practice you should always use an upper case L for clarity if you need to specify long numbers, but the compiler will still let through a lower case l with the same functionality.

Again, with the:

int num = 0123;

question, it seems you both put 0123 or 123 - but actually, when you start an integer with 0 this tells Java you're writing it in octal, not in decimal... ;-)

See where this quiz is going now?
berry120 is offline   Reply With Quote
Old 08-23-2009, 01:21 PM   #8
Guru
 
JogaBonito1502's Avatar
 
Join Date: Jan 2008
Location: U.S.
Posts: 7,841
Default Re: So... you think you know Java?

That's dirty lol, but to be honest I'm not really disappointed or anything. I've never programmed in Java.
JogaBonito1502 is offline   Reply With Quote
Old 08-23-2009, 01:42 PM   #9
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: So... you think you know Java?

Quote:
That's dirty lol, but to be honest I'm not really disappointed or anything. I've never programmed in Java.
I wouldn't be - if you get more than 1 or 2 right and you've never done Java before then that's pretty good going!
__________________

berry120 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 10:41 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0