Question 10 :

Which of the following statements are true about the sleep method of Thread class? 
Select two choices.

Picture


Question 11 :

What would be the result of an attempt to compile and run the following code? 
Choose one answer.
Picture

a.       The code compiles fine and prints Two, One, and Three in order and repeats the same for another 19          times. 
b. The code compiles fine and prints Two 20 times, One 20 times, and Three 20 times sequentially. However, the order whether Two will come first, then One, and at last Three is not guaranteed. 
c. The code compiles fine and prints Two 20 times, One 20 times, and Three 20 times sequentially and the behavior is guaranteed. 
d. The code compiles fine and prints Two, One, and Three 20 times each in an indefinite order. 
e. The code compiles fine but throws InterruptedException due to synchronization of msg String in a wrong way.



Question 12 :
What would be the result of an attempt to compile and run the following code?


Choose one answer.
Picture
a.       It will not compile because SimpleThread is a subclass of thread, but does not have a no-argument public constructor. 
b. It will not compile because two separate threads in line A and line B have been given the same name "Java Programmer". 
c. It will compile, but at runtime the second thread will overwrite the first thread and so the run method of the SimpleThread class will be executed only once instead of twice. 
d. It will compile but will throw RuntimeException. 
e. It will compile and run with success and the run method of SimpleThread class will be executed twice by two separate threads created.


ALL about SCJP = SCJP 1.6, mock, certification, scjp 1.5 , scjp questions, scjp books, scjp hand written notes, scjp dumps, scjp trainings, scjp video tutorials, scjp simulators etc.