wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes some ?s! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "some ?s!" Watch "some ?s!" New topic
Author

some ?s!

ashok khetan
Ranch Hand

Joined: Jul 29, 2001
Posts: 153
hi,
here are some questions from http://www.certification4career.com/sun/java/programmer/exam1.html
but i think the answers of some ques. given on the site are wrong, so i am putting some ques. here. Some questions are also ambigious, e.g. in the first ques.(option:c), it's not clear whether it is a top-level class or an inner class; so what should we answer? In Q29 the option c can't be correct 'coz if the class is defined in a non-static method then the inner class can access any instance variable of the enclosing class but if the class is defined in a static method then the inner class can only access the static class variables of the enclosing class.
thanx.
ashok.
_______
Q17.The private modifier can be applied to ...
a)A variable
b)A method
c)A class
d)All of the above
_______
Q20.An unary operators operate on a single value
a)True
b)False
_______
Q22.The switch() construct is used to make a choice based upon ...
a)A char value
b)An int value
c)A String value
d)None of the above
_______
Q23.The circumstances that can prevent execution of the code in a finally block are
a)the death of the thread
b)The use of System.exit()
c)It is always guaranteed to be executed.
_______
Q32.Please select invalid statement(s) for a thread
a)You can restart a dead thread
b)You can't call the methods of a dead thread
c)Both of the above
d)None of the above
_______
Q29.An inner class created inside a method can access
a)Any local variables of a method that contain an inner class.
b)Any instance variables of the enclosing class
c)Any final variables of the enclosing class or a method that contain an inner class.
d)None of the above
_______
(fixed link)
[This message has been edited by Marilyn deQueiroz (edited September 06, 2001).]
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
In the first question
Q17.The private modifier can be applied to ...
a)A variable
b)A method
c)A class
d)All of the above
It is just asking what private can be applied to. If it can be applied to class, then that is a correct answer. You are trying to read too much into the question.
Usha Damarla
Greenhorn

Joined: Aug 29, 2001
Posts: 13
Hi Ashok,
Q17.The private modifier can be applied to ...
a)A variable
b)A method
c)A class
d)All of the above
Ans: I would answer 'd'
I don't mind whether it is a inner class or top level class as far as it is a class.
When they ask question like this "What modifiers can we apply for a top level class?", then you know what to answer (public & default).
Q20.An unary operators operate on a single value
a)True
b)False
Answer: a
Example:
int i = 1;
i = 2 + -3;
System.out.println(i);
Q22.The switch() construct is used to make a choice based upon ...
a)A char value
b)An int value
c)A String value
d)None of the above
Answer: a,b
But Java2 Exam Prep by Bill Brogden does not mention about 'char value' in the book, but JLS does.
May be char gets promoted to int or shorter than int primitive.
Someone has to clear this.
Q23.The circumstances that can prevent execution of the code in a finally block are
a)the death of the thread
b)The use of System.exit()
c)It is always guaranteed to be executed.
Answer: a,b
Q32.Please select invalid statement(s) for a thread
a)You can restart a dead thread
b)You can't call the methods of a dead thread
c)Both of the above
d)None of the above
Answer: a
_______
Q29.An inner class created inside a method can access
a)Any local variables of a method that contain an inner class.
b)Any instance variables of the enclosing class
c)Any final variables of the enclosing class or a method that contain an inner class.
d)None of the above
Answer: a,b,c
I am just looking at one side of the coin in this case.
My answers may be wrong, please correct me.
Regards
Usha
Ragu Sivaraman
Ranch Hand

Joined: Jul 20, 2001
Posts: 464
Usha,
Q32.Please select invalid statement(s) for a thread
a)You can restart a dead thread
b)You can't call the methods of a dead thread
c)Both of the above
d)None of the above
I think the answer is C
_______
Q29.An inner class created inside a method can access
a)Any local variables of a method that contain an inner class.
b)Any instance variables of the enclosing class
c)Any final variables of the enclosing class or a method that contain an inner class.
d)None of the above
I think the Answer is B and C
Let me know
Thankx
swati bannore
Ranch Hand

Joined: Oct 18, 2000
Posts: 201
Hi,
i agree with Rahgu's answers.
You CAN call methods of a Dead Thread.
Classes defined within the scope of a method can access instance variables from Outer class plus ONLY final variables from the enclosing method..as class lives longer than method..so can access only constants.
thanx


Swati Kale
SCJP
SCWCD
Cameron Park
Ranch Hand

Joined: Apr 06, 2001
Posts: 371
Will death to a Thread cause finally block to be skipped? I don't see how that will happen. Can someone help clarifying the concept?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: some ?s!