Appendix F. Mock Exam

This is a mock exam for the Sun Certified Programmer for the Java 2 Platform (SCPJ2 1.4). It comprises brand new questions, which are similar to the questions that can be expected on the real exam. Working through this exam will give the reader a good indication of how well she is prepared for the real exam, and whether any topics need further study.

Q1 Given the following class, which statements can be inserted at position 1 without causing a compilation error?
public class Q6db8 {
    int a;
    int b = 0;
    static int c;

    public void m() {
        int d;
        int e = 0;

        // Position 1
    }
}

Select the four correct answers.

  1. a++;

  2. b++;

  3. c++;

  4. d++;

  5. e++;

Q2 Which statements are true about the effect of the >> and >>> operators?

Select the three correct answers. ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.