CertGear - Certification Practice Tests /Exams For PHR, SPHR, GPHR, SCWCD, SCBCD, SCDJWS, SCJP, PMP Test Prep Products Built To Satisfy The Most Demanding Professional.
Certification Practice Tests For PHR, SPHR, GPHR, SCWCD, SCBCD, SCDJWS, SCJP, PMP
CertGear Products - Certification Practice Tests For PHR, SPHR, GPHR, SCWCD, SCBCD, SCDJWS, SCJP, PMPCertGear Products - Certification Practice Tests For PHR, SPHR, GPHR, SCWCD, SCBCD, SCDJWS, SCJP, PMPAbout CertGearCertGear Affiliates ProgramCertGear Technical SupportCertGear Product Downloads - Certification Practice Tests For PHR, SPHR, GPHR, SCWCD, SCBCD, SCDJWS, SCJP, PMP
Practice Tests
PHR Practice Tests
SPHR Practice Tests
SCJP Practice Tests
SCWCD Practice Tests
SCBCD Practice Tests
SCDJWS Practice Tests
PMP Practice Test
GPHR Practice Tests

 
 SCJP Certification Practice Test  

Features Of CertGear's SCJP (CX-310-035) Certification Practice Test

  • Learn As You Go - Detailed explanations tell you not just the right answer, but why the right answer is right and the wrong answers are wrong. References for further study are also provided.

  • Customized Options - You decide the way you want to take the testing including:
    Timed, Live scoring, Randomization, Ask Incorrect, Show Answer, Select # of questions.

  • Ask Only The Questions You Got Wrong - This is a great feature. At the end of the exam, instead of being asked every question again, you can tell the test engine to only ask you questions that you got incorrect.

  • Randomization - The tests in our certification mode are dynamic, not fixed like some other practice tests are, so you'll get a new test every time. Each test is timed and the objectives are weighted the same as on the real exam.

  • History - The test engine keeps a history of all the exams and scores you have achieved on those tests. You can easily track your progress and help determine when you are ready to take the actual exam.

  • Categories - Many tests contain categories for you to selectively study topics. Additionally, you can see your grade in each category at the end of the exam.

  • Graphic Scoring - Graphical Breakdown Of Exam Results To Pinpoint Areas To Focus Your Study Effort..

  • Updates - Keep Up-To-Date With The Most Current And Most Accurate Exam Questions / Answers / Explanations With Complimentary Product Updates.

 


Free SCJP Certification Practice Questions:

Consider the following multi-threaded code that users inner-class declarations to create and execute multiple threads. What will be the output of the code?

1:public class test
2:{
3:      public static void main (String args[])
4:      {
5:      final String s="s";
6:      final Thread t= new Thread (new Runnable ()
7:        {
8:        public void run () {
9:          try
10:          {
11:           for (int i=1; i < 5; i++)
12:            {
13:             synchronized (this)
14:              {
15:               System.out.print (" " + i);
16:               this.wait ();
17:              }
18:            }
19:          } catch (Exception ex) { ex.printStackTrace (); }
20:         }
21:      });
22:
23:     Thread t2 = new Thread (new Runnable ()
24:       {
25:       public void run () {
26:         while (true)
27:         {
28:         synchronized (this) { this.notify (); }
29:         }
30:        }
31:       });
32:     t.start ();
33:     t2.start ();
34:     }
35:}
A) A compilation error will occur
B) 1 2 3 4 will be printed
C) A run-time error will be thrown
D) Nothing will be printed to the output
E) 1 will be printed
  • [Ans: E]

  • Explanation: Although the code may look unusual due to the anonymous inner-class declaration, it is perfectly legal and will compile correctly. In addition, the code correctly invokes the wait () and notify () methods by obtaining a synchronized lock on the object at line #13 & line#28. Specifically, the wait () and notify () methods must be called from within a synchronized context. Therefore, no run-time exceptions will be thrown.

    Notice that at line #16, Thead t calls wait () on the this object. Also notice that at line #28, Thread t2 calls notify () on this object as well.

    However, the this Object at line #28 refers to the instance of anonymous inner-class that implements Runnable at line #23, while the this Object at line #16 refers to the instance of anonymous inner-class that implements Runnable at line #6. Since the two threads are referring to two different objects, the notify () at line #28 will NOT unblock the wait () at line #16.

    So even though Thread t2 calls this.notify () at line #28, it will NOT unblock the wait () method at line #16, since the Thread t is waiting on a different object than the object that Thread t2 is notifying.

    So the Thread t will execute line #15, and print out the value "1", and then block indefinitely at line #16.

    References: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait(long)



BACK    |    NEXT

 

For Additional SCJP Certification Practice Questions, Please Download A Free Copy Of Our SCJP Certification Exam Simulator (300+ Questions):

[SCJP Certification Practice Test]     [Buy Now | Download]


 

  HRCI Certifications :  PHR, SPHR, GPHR   |    PMI Certifications: PMP
Java Certifications :  SCWCD, SCBCD, SCJDWS, SCJP  | Security Certifications: CISSP, CISA