aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Khalid Mock Exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Khalid Mock Exam" Watch "Khalid Mock Exam" New topic
Author

Khalid Mock Exam

Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
Hi guys,
It is really hard. is it worth of doing khalid Mock Exam? because every time i tried it and never got good marks. main problem is u don't know what was the problem ? what did u do wrong ?
do we have answer any where except book?
Please help me to find out the answer for following two questions from khalid:
Q#1
Which line of code are valid declarations of a native method when occurring within the declaration of the following class?
public class Qf575{
//insert declaration of a native method here
}
1. native public void setTemperatuere(int kelvin);
2. private native void setTemperatuere(int kelvin);
3. protected int vative getTemperatuere();
4. public abstract native void setTemperatuere(int kelvin);
5. native int setTemperatuere(int kelvin) {}
Q#2
Under which circumstances will a thread stop?
1. The method waitforid() in class MediaTracker is called.
2. The run() method that the thread is executing ends.
3. The call to the start() method of the Thread object returns.
4. The suspend() methods is called on the Thread object.
5. The wait() method is called on the Thread object.
My answer would be 1,2,4,5.
any help would be appreciated.
vivek
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Vivek
I am 100% with you as far as Khalid's exam is concerned. In fact few weeks back I requested source of answers on this forum but it seems answers are available only in his book.
According me answers of your question no 2 are same as what I am thinking. Anyone can correct us.
Regarding question 1
1. native public void setTemperatuere(int kelvin);
It is valid declaration as order of modifers does not matter.
2. private native void setTemperatuere(int kelvin);
It is also valid declaration
3. protected int vative getTemperatuere();
I think here is one typo you mean to say native instead of vative, anyway it is not a valid one,
return type int is declared in between two modifiers.
protected native int getTemprature(); would have been valid decl.
4. public abstract native void setTemperatuere(int kelvin);
Invalid as compiler says abstract methods cannot be native.
5. native int setTemperatuere(int kelvin) {}
Invalid declaration as native methods cannot have method body.
Anyone can please correct.
Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
Please come forward to help me.
vivek
chetan nain
Ranch Hand

Joined: Jun 21, 2000
Posts: 159
siva, your observations are correct
Uvnik Gupta
Ranch Hand

Joined: Jul 24, 2000
Posts: 32
siva is right about Q#1 but according to me the correct answer for Q32 is option #2 only. Because waitforid(), suspend() and wait() all put the thread to "waiting" or "blocked" state. They don't "stop" the thread. The thread gets stopped or destroyed only when the run() methods ends.
lstrite
Greenhorn

Joined: Jul 10, 2000
Posts: 20
Can someone post the link to the khalid exam?
Thanks!
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
It is right here - http://www.ii.uib.no/~khalid/pgjc/jcbook/engine.html

Good luck,
Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Khalid Mock Exam