aspose file tools*
The moose likes Beginning Java and the fly likes Test question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Test question" Watch "Test question" New topic
Author

Test question

Igor Mechnikov
Ranch Hand

Joined: Feb 13, 2011
Posts: 100

Which statements are correct? (edit: i pasted in different question earlier, need to be more careful proof-reading)
I did not like any of the answer choices to this question and thought correct answer would have 1, 2, and 4.


Here is the question:
Which statements are true?

Declaring a variable does not create an object.
In Java, no variable can ever hold an object.
You can create an object in Java by declaring it.
A variable can only hold a reference to an object.

Choose one answer.
a. All of the above
b. 2, 3, 4
c. 2, 4
d. 1, 3, 4

(Instructor)
The right answer is (a).


Thank you


String knock = "\u042F \u0418\u0433\u043e\u0440\u044c";
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Why not #3?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39834
    
  28
Always tell us where the question is from. Those are poorly-worded questions, with vague answers.
Igor Mechnikov
Ranch Hand

Joined: Feb 13, 2011
Posts: 100

marc weber wrote:Why not #3?

nothing, I posted wrong question, please see edit above
Igor Mechnikov
Ranch Hand

Joined: Feb 13, 2011
Posts: 100

Campbell Ritchie wrote:Always tell us where the question is from. Those are poorly-worded questions, with vague answers.

This came from the recent final exam for an online Programming I course offered by a yet unaccredited school.
The course used math.hws.edu/javanotes as the text.
edit: just read the exam question copyright notice, the school endeavors to offer its materials under creative commons license
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Ii Mechnikov wrote:... I did not like any of the answer choices to this question and thought correct answer would have 1, 2, and 4.

Here is the question:
Which statements are true?

Declaring a variable does not create an object.
In Java, no variable can ever hold an object.
You can create an object in Java by declaring it.
A variable can only hold a reference to an object.

Choose one answer.
a. All of the above
b. 2, 3, 4
c. 2, 4
d. 1, 3, 4

(Instructor)
The right answer is (a)...

I agree with Campbell in saying these questions are vague and poorly worded.

That said, I agree with 1 and 2.

But I would say number 3 is false. You can create a new object and assign its reference on the same line as the declaration, but the declaration itself does not create an object (as number 1 seems to say).

I would also say number 4 is false, because a variable can also hold a primitive value.
Igor Mechnikov
Ranch Hand

Joined: Feb 13, 2011
Posts: 100

marc weber wrote:
Ii Mechnikov wrote:... I did not like any of the answer choices to this question and thought correct answer would have 1, 2, and 4.

Here is the question:
Which statements are true?

Declaring a variable does not create an object.
In Java, no variable can ever hold an object.
You can create an object in Java by declaring it.
A variable can only hold a reference to an object.

Choose one answer.
a. All of the above
b. 2, 3, 4
c. 2, 4
d. 1, 3, 4

(Instructor)
The right answer is (a)...

I agree with Campbell in saying these questions are vague and poorly worded.

That said, I agree with 1 and 2.

But I would say number 3 is false. You can create a new object and assign its reference on the same line as the declaration, but the declaration itself does not create an object (as number 1 seems to say).

I would also say number 4 is false, because a variable can also hold a primitive value.

Thank you for replying.
4 is ambiguous, it would be correct if it specified 'in addition to primitive values'.
I was wondering if I am missing something regarding 1 and 3. Am I correct to think that 1 and 3 exclude each other?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Ii Mechnikov wrote:... I was wondering if I am missing something regarding 1 and 3. Am I correct to think that 1 and 3 exclude each other?

Your thinking is correct. You shouldn't have to guess, but if your instructor says number 3 is true, I think he/she is trying to say you can do this...

...instead of this...

But as it's worded, I say number 3 is false. Simply declaring an object does not create one. (Note that null is a special reference type -- not an object. So default initialization does not create an object.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Test question