Some of our chapters have a lot of questions. For example, Chapter 3 contains more than 200 questions. This is based on how Oracle chose to organize its objectives. We recommend doing these larger chapters in batches of 30–50 questions at a time. That way you can reinforce your learning before doing more questions. This also lets you practice with sets of questions that are closer to the length of the exam.
Taking the Practice Exams
Chapters 14, 15, and 16 of this book contain three full‐length practice exams. The questions in these chapters are quite different from the objective‐based chapters in a number of important ways. These practice exam questions tend to be harder because they are designed to test your cumulative knowledge rather than reinforcing your existing skill set. In other words, you may get a question that tests two discrete topics at the same time.
Like the objective chapters, we do indicate exactly how many answers are correct in the practice exam chapters, as is done on the real exam. All three practice exam chapters are designed to be taken within 90 minutes and have a passing score of 68 percent. That means you need to answer at least 34 questions correctly. Remember not to take the practice exam until you feel ready. There are only so many practice exams available, so you don't want to waste a fresh attempt.
While an objective‐based chapter can be completed over the course of a few days, the practice exam chapters were each designed to be completed in one sitting. You should try simulating the exam experience as much as possible. This means setting aside 90 minutes, grabbing a whiteboard or scrap paper, and answering every question even if you aren't sure of the answer. Remember, there is no penalty for guessing, and the more incorrect answers you can eliminate the better.
Reviewing Exam Changes
Oracle does change the number of questions, passing score, and time limit from time to time. Scott and Jeanne maintain a blog that tracks updates to the real exams, as quickly as Oracle updates them.
www.selikoff.net/ocp11-pt
We recommend you read this page before you take the real exam, in case any of the information since the time this book was published has changed. Although less common, Oracle does add, remove, or reword objectives. When this happens, we offer free supplemental material on our website as blog entries.
Ready to Take the Exam
If you can score above 70 percent consistently on all of the chapters related to the exam you want to take, including above a 70 percent on the simulated practice exam, then you are probably ready to take the real exam. Just remember there's a big difference between taking a practice test by yourself in your own home, versus spending hundreds of dollars to take a real proctored exam.
Although a lot of people are inclined to cram as much material as they can in the hours leading up to the exam, most studies have shown that this is a poor test‐taking strategy. The best thing we can recommend that you do before the exam is to get a good night's rest!
Need More Help Preparing?
Both of the authors are moderators at CodeRanch.com
, a very large and active programming forum that is very friendly toward Java beginners. See the OCP Forum.
coderanch.com/f/24
If you don't understand a question, even after reading the explanation, feel free to ask about it in one of those forums. You'll get an answer from a knowledgeable Java programmer. It might even be one of us.
Good luck on the exam and happy studies!
Interactive Online Learning Environment and Test Bank
To access the interactive online learning environment and test bank, simply visit www.wiley.com/go/sybextestprep
, register to receive your unique PIN, and instantly gain one year of FREE access after activation to the interactive test bank with 3 practice exams and hundreds of domain‐by‐domain questions. Over 1,000 questions total!
Chapter 1 Working with Java Data Types
THE OCP EXAM TOPICS COVERED IN THIS PRACTICE TEST INCLUDE THE FOLLOWING:
Working with Java Data TypesUse primitives and wrapper classes, including, operators, parentheses, type promotion and castingHandle text using String and StringBuilder classesUse local variable type inference, including as lambda parameters
1 Which of the following are not valid variable names? (Choose two.)__blue2blueblue$Blue
2 What is the value of tip after executing the following code snippet?int meal = 5; int tip = 2; var total = meal + (meal>6 ? tip++ : tip--);1237None of the above
3 Which is equivalent to var q = 4.0f;?float q = 4.0f;Float q = 4.0f;double q = 4.0f;Double q = 4.0f;Object q = 4.0f;
4 What is the output of the following?12: var b = "12"; 13: b += "3"; 14: b.reverse(); 15: System.out.println(b.toString());12123321The code does not compile.
5 What is the output of the following?5: var line = new StringBuilder("-"); 6: var anotherLine = line.append("-"); 7: System.out.print(line == anotherLine); 8: System.out.print(" "); 9: System.out.print(line.length());false 1false 2true 1true 2It does not compile.
6 Given the following Venn diagram and the boolean variables, apples, oranges, and bananas, which expression most closely represents the filled‐in region of the diagram?apples && oranges && !bananasorange || (oranges && !bananas)(apples || bananas) && orangesoranges && apples(apples || oranges) && !bananasapples ^ oranges
7 What is the output of the following?5: var line = new String("-"); 6: var anotherLine = line.concat("-"); 7: System.out.print(line == anotherLine); 8: System.out.print(" "); 9: System.out.print(line.length());false 1false 2true 1true 2Does not compile
8 Which can fill in the blank? (Choose two.)public void math() { _____ pi = 3.14; }bytedoublefloatshortvar
9 Fill in the blanks: The operators !=, _______, _______, _______, and ++ are listed in the same or increasing level of operator precedence. (Choose two.)==, *, !/, %, **, ‐‐, /!, *, %+=, &&, **, <, /
10 How many of these compile?18: Comparator<String> c1 = (j, k) -> 0; 19: Comparator<String> c2 = (String j, String k) -> 0; 20: Comparator<String> c3 = (var j, String k) -> 0; 21: Comparator<String> c4 = (var j, k) -> 0; 22: Comparator<String> c5 = (var j, var k) -> 0;012345
11 The author of this method forgot to include the data type. Which of the following reference types can best fill in the blank to complete this method?public