File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubts in mock exam ques 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 "doubts in mock exam ques" Watch "doubts in mock exam ques" New topic

doubts in mock exam ques

Mamta Jha

Joined: Oct 18, 2000
Posts: 8
hi friends,
These are some of the quest from a mock exam-
Q1. Which of the following are true about the class defined inside an interface
1> it is not possible in the java Laungage. //ans
2> The class is always public.
3> The class is always static.
4> the class methods cannot call the methods declared in the interface.
5> the class methods can call only the static methods declared in the interface.
my ans is 2.
Q2.What does the following expression return
3>runtime Exception
when I tried this using a code , the answer comes id infinity.Does Double.POSITIVE_INFINITY and infinity mean the same.
Q3.Assume that th is an instance holding a thread object. th.start() causes the thread to start running and eventually complete its execution. The object reference by th is not accessable any more and is garbage collected when the garbage collecter runs.
False //ans
Shouldn't the thread object get gced after completion of run? so the ans should be true.
Q4. can we explicitly call the constructor of an abstract class?
I'll be thankful if anyone could give the correct explanation for these.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Mamta,
Q1. 1 - TRUE. An Interface can contain constants and empty method declarations but NOT classes. Classes and Interfaces are both types in Java. (see JLS�.4.3)
Correction: Sorry Mamta. Just discovered that you CAN declare classes within an interface. Any classes nested inside an interface are Static and Public.

Q2. The value does print as just Infinity. When I ran a test using the following code both if statements printed.

So I don't think, for practical purposes, the two values are different. The JSK defines them as

Q3. Think the answer is FALSE. The Java Programming Language states "when a thread dies, its object doesn't go away" which I interpret to mean just because a thread ends does not mean the object is available for gc.
Q4. Think the answer to this is Yes. An abstract class cannot be instantiated BUT a subclass of an abstract can use super() to call an abstract class ctor.

Hope that helps.
[This message has been edited by Jane Griscti (edited October 21, 2000).]
[This message has been edited by Jane Griscti (edited October 21, 2000).]
[This message has been edited by Jane Griscti (edited October 21, 2000).]

Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
suneeta prattipati

Joined: Oct 16, 2000
Posts: 8
Hi Mamta,
ans to Q3)
the start() method does not cause the thread to start running. You need the run method for that. start() just makes the thread eligible to run. So the ans is FALSE.
Mamta Jha

Joined: Oct 18, 2000
Posts: 8
thanks jane & suneeta
I agree. Here's the link:
subject: doubts in mock exam ques
jQuery in Action, 3rd edition