Hey everyone. I am hosting a java quiz show for our JUG

D

Dan Hinojosa

The quiz show will just have some slides and multiple-choice answers:

Here is a copy of the rules that were sent out to the jug:


<rules>
What I need from all of you is a small, but tricky java question. It
has to be a java question that you think will stump the majority of the
crowd, but not so difficult that you make us crawl into a fetal position
and cry. The other requirement is that your question be small enough so
that all of us can work it out mentally. The question should be able to
fit on a standard powerpoint slide using an approximately 24pt font.
The questions can use 1.5's latest technologies, but I believe we'd
prefer code snippets that can run on 1.4 since we are all not up to
speed yet on the latest java. Finally, be sure to include four multiple
choice answers to your question. It would also help if one out of those
four answers is the correct response to the question.
</rules>


I was wondering if anyone here has some goodies they would like to give me?

Thanks,
Danno
 
M

Mike Schilling

I was wondering if anyone here has some goodies they would like to give
me?

Q. Why doesn't Java have pointers?
A. It does; it just calls them "references".
 
D

Dan Hinojosa

Mike said:
"Dan Hinojosa" <dhinojosa-squigglything-evolutionnext-dot-com> wrote in
message



Q. Why doesn't Java have pointers?
A. It does; it just calls them "references".

Someone needs to change java.lang.NullPointerException then. :)
 
J

Joona I Palaste

Q. Why doesn't Java have pointers?
A. It does; it just calls them "references".

And does not use pointer arithmetic, making the pointers entirely
opaque.
 
M

Mike Schilling

Joona I Palaste said:
And does not use pointer arithmetic, making the pointers entirely
opaque.

True in most languages that use pointes; C and C++ are the only exceptions
that come to mind.
 
J

John

Dan said:
The quiz show will just have some slides and multiple-choice answers:

Here is a copy of the rules that were sent out to the jug:


<rules>
What I need from all of you is a small, but tricky java question. It
has to be a java question that you think will stump the majority of the
crowd, but not so difficult that you make us crawl into a fetal position
and cry. The other requirement is that your question be small enough so
that all of us can work it out mentally. The question should be able to
fit on a standard powerpoint slide using an approximately 24pt font. The
questions can use 1.5's latest technologies, but I believe we'd prefer
code snippets that can run on 1.4 since we are all not up to speed yet
on the latest java. Finally, be sure to include four multiple choice
answers to your question. It would also help if one out of those four
answers is the correct response to the question.
</rules>


I was wondering if anyone here has some goodies they would like to give me?

Thanks,
Danno

I'd struggle to work this out in my head, but I'm sure I could have an
educated guess looking at the flow of control.


static void draw(int n) {
for(int i = -n/2;i <= n/2; i++) {
for(int j=0;j <= n-1-((i < 0)?-i:i);j++) {
System.out.print((j < ((i < 0)?-i:i))?" ":"*");
}
System.out.println();
}
}

What shape does draw(5) produce on the terminal screen?

1. A circle
2. A diamond
3. A triangle
4. An hourglass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top