How I Prepared for OCP Java SE 11, 2021

Written by parvizjon | Published 2021/06/01
Tech Story Tags: programming | ocpjp | java | learn-java | java11 | certification | education | oracle

TLDR The OCP is Oracle Certified Professional Java SE 11 Developer exam. The exam is 90 minutes long and has 50 questions covering all topics from past exams, with a passing grade of 68%. Most of the questions can have several correct answers. You should also spend a lot of time taking mock exams, including tests by topics, imitation of a real exam, notes, etc. The answers will be at the end: "What will the following code print?" "How will the code print when run? "How do you know how to run the Java SE application?"via the TL;DR App

Hi there! My name is Parviz. I would like to share my experience obtaining the coveted title of Oracle Certified Professional Java SE 11.
I also received a limited edition badge because I passed the exam during the promotion period until April 25, 2021!

Why do you need certification?

Do you need it at all?
The usefulness of professional certification is an oft-debated topic amongst professional developers. Some are convinced that a certificate is highly desirable to get a decent job. Others say that certificates do not play an important role, that even a higher education diploma may not be required - only skills and work experience matter.
Obtaining a qualification is a great way to structure your knowledge and delve deeper into the programming language (or database, cloud technologies, etc.).

About the path to certification

Previously, to get an OCP, you had to pass the OCA (Oracle Certified Associate). Fortunately, for Java 11, now you can immediately gain the OCP upon passing the 1Z0-819 - Java SE 11 Developer exam. In addition, the number of questions has changed; if earlier there were 80 questions in each exam and for this 150 minutes were allotted, now the exam is 90 minutes long and has 50 questions covering all topics from past exams, with a passing grade of 68%.
Most of the questions can have several correct answers. Now you have the option to take the exam from the comfort of your own home. In that case, you will be observed through the camera and microphone throughout the exam.
There should be no one in the room, you cannot talk to anyone and only look at the screen, and your internet connection must be stable, without interruptions. Otherwise, the exam is canceled. I chose the online option (and received two warnings during the exam).
Review of exam topics
  • Working with Java data types
  • Controlling Program Flow
  • Java Object-Oriented Approach
  • Exception Handling
  • Working with Arrays and Collections
  • Working with Streams and Lambda expressions
  • Java Platform Module System
  • Concurrency
  • Java IO & NIO API
  • Secure Coding in Java SE Application
  • Database Applications with JDBC
  • Localization
  • Annotations
You can find a more detailed topic list here
I would like to draw your attention to the fact that I came across a lot of questions about data type, controlling flow, streams, lambdas, and functional interfaces. However, for other topics, there were only 1-2 questions.

Recommended reading list

To be prepared for the exam questions, you should read the certification books that cover the nuances of the questions. Each person’s preparation may take a different amount of time - if you are a java teacher, then it's a couple of days to look at the list of topics and repeat the material. If that's not the case, then I would allocate 1 - 2 months for the preparation.

Solve mock exams

You should also spend a lot of time taking mock exams. I bought mock exams from enthuware. They have a lot of useful functionality, including tests by topics, imitation of a real exam, notes, etc.

What questions you may encounter

Have a go at solving these problems. The answers will be at the end:
    1. What will the following code print?
    outer:
      for ( var i = 0 ; i<3 ; i++ ){
         for ( var j = 0 ; j<2 ; j++ ){
            if ( i == j ){
               continue outer;
            }
            System.out.println( "i=" + i + " , j=" + j );
         }
      }
    
    2. What will the following code print when run?
    Deque<Integer> d = new ArrayDeque<>();
     
    d.add(1);
    d.add(2);
    d.addFirst(3);
     
    System.out.println(d.pollLast());
    System.out.println(d.pollLast());
    System.out.println(d.pollLast());
    
    3. What will the following code fragment print? 
    Path p1 = Paths.get("photos/goa"); 
    Path p2 = Paths.get("/index.html");
    Path p3 = p1.relativize(p2);
     
    System.out.println(p3);
    
    4. Given:
    @Target({ElementType.LOCAL_VARIABLE, ElementType.FIELD, ElementType.METHOD}) //1
    @Target({ElementType.TYPE})//2
    @Retention(RetentionPolicy.RUNTIME)//3
    public @interface DebugInfo { //4
       String name() default=""; //5
       String[][] params();//6
       java.util.Date entryTime();//7
    }
    
    Which line(s) will cause compilation failure?
    5. Which of the following interface definitions can use Lambda expressions?
    //1
    interface A{
    }
     
    //2
    interface A{
       default void m(){};
    }
     
    //3
    interface A{
       void m(){};
    }
     
    //4
    interface A{
       default void m1(){};
       void m2();
    }
     
    //5
    interface A{
       void m1();
       void m2();
    }
    
    Answers:
      1.The given code prints:
      i=1, j=0; i=2, j=0; i=2, j=1.
      2. It will print
      2, 1, 3.
      3. It will throw j
      ava.lang.IllegalArgumentException
      . If one path has a root and the other does not, relativize cannot work, and it will throw an
      IllegalArgumentException.
      4. 
      2, 5, 6, 7
      lines will cause compilation failure.
      5. 
      4.

Summary

To summarize, I spent 2-3 weeks preparing for the exam and passed with a grade of 70 percent. This helped me structure my knowledge and delve deeper into my programming language. So why didn't I prepared for 1-2 months as I recommended you? Because I was in a hurry and wanted to get a limited edition 25th anniversary of the Java language badge. 

Written by parvizjon | 9+ years of experience in building massively scalable systems both from scratch and diving into an existing codebase.
Published by HackerNoon on 2021/06/01