Whizlabs offers SCJP 6.0 Exam Simulator with 420 questions as per the SCJP 6.0 certification exam. Following are couple of sample SCJP Questions.

Topic: Flow Control

SCJP Question statement: What is the result of compiling and running the given code?

class A
{
     int b=10;
     private A()
     {
          this.b=7;
     }
     int f()
     {
          return b;
     }
}
class B extends A{ int b; }
class Test
{
     public static void main(String[] args)
     {
          A a=new B();
           System.out.println(a.f());
     }
}

Choices:

  1. Does not compile
  2. Prints 0
  3. Prints 10
  4. Prints 7





Click here for correct answer and explaination

Correct Answer: A

Explaination:

Choice A is the correct answer.

The code does not compile because the constructor of class A is declared as private. This creates a problem when the subclass constructor makes an implicit super() call to the parent class constructor at the time B is instantiated.

Since the code does not compile, all the other choices are incorrect. If the constructor of A had not been private, the output would have been 7.


Topic: Collections/Generics

SCJP Question statement: Which of these will compile and run? Select two choices.

Choices:

  1. LinkedList<Integer> l=new LinkedList<int>();
  2. List<Number> l=new LinkedList<Number>();
  3. LinkedList<Integer> l=new <Integer>LinkedList();
  4. List<Number> l=new LinkedList<Integer>();





Click here for correct answer and explaination

Correct Answer: B & C

Explaination:

Choices B and C are the correct answers.

The List interface is implemented by the LinkedList class. So List<Number> is the super type of LinkedList<Number>, which accepts only objects of type Number. LinkedList<Integer> declares a list that accepts only Integer objects. Assigning a LinkedList raw type to it gives warnings of unsafe operations, however, it does compile and run without errors.

Choice A is incorrect because generic parameters cannot be primitives.

Choice D is incorrect because the right hand side of the assignment uses the wrong syntax.

Choice E is incorrect because List<Number> is not a supertype of LinkedList<Integer>.

Reference:
http://java.sun.com/docs/books/tutorial/extra/generics/index.html

 


What's Next?
SCJP 6.0 Exam Simulator You can try out our 15 SCJP Questions Trial Test for FREE. Till now more than 19,000 participants have appeared in the trial exam . Try out the test and assess your rank compare to other test takers. This will help you to assess your strengths, weaknesses, speed and accuracy level in each Objective of SCJP 6 Certification Exam. If you are looking for more questions check out SCJP 1.6  Dumps. It has couple of interesting SCJP questions.




Customer Reviews

Perfect mock. The review is perfect because you can read all details about the question, the options, etc. Its a complete and practical study reference. I passed with a close score, 60%, but I just studied 1 week using just Mark Cade guide and Whizlabs mocks.

By Bernardo Read More....

I am glad to inform you that I have passed PMP exam, thank you to whizlabs PMP software that helped me gain confidence and clear the exam.

By Venkata Chinnam Read More....

I found the whizlabs software very good and sat the exam on the 4th August 2009 scoring a pass of 75%. I found that I did very badly on the API contents section(42) so this pulled down my score a bit – I was hoping for 80+% but didn’t put in enough work! On the plus point I did score highly on concurrency (100) an generics/collections(87). Overall I would recommend the whizlabs software to colleagues.

By Tamasin Mari Reardon Read More....