Exam Title: Upgrade to Java SE 8 OCP ( Java SE 6 and all prior versions)
Exam Number: 1Z0-813
Exam Price: $245.00 More on exam pricing
Format: Multiple Choice
Duration: 130
Number of Questions: 60
Passing Score: 63%
Validated Against: This exam is validated against Java SE 8.
Take Recommended Training Courses
Complete one of the courses below to prepare for your exam (optional):
Java SE 7 New Features
Java SE 8 New Features
Additional Preparation and Information
A combination of Oracle training and hands-on experience (attained via labs and/or field experience) provides the best preparation for passing the exam.
A combination of Oracle training and hands-on experience (attained via labs and/or field experience) provides the best preparation for passing the exam.
Practice Exams: Oracle Authorized practice exam from Kaplan IT Training: 1Z0-813: Upgrade to Java SE 8 OCP Programmer
Sample Questions
Language Enhancements
Develop code that uses String objects in the switch statement, binary literals, and numeric literals, including underscores in literals
Develop code that uses try-with-resources statements, including using classes that implement the AutoCloseable interface
Develop code that handles multiple Exception types in a single catch block
Use static and default methods of an interface including inheritance rules for a default method
Localization
Describe the advantages of localizing an application and developing code that defines, reads, and sets the locale with a Locale object
Build a resource bundle for a locale and call a resource bundle from an application
Create and manage date- and time-based events by using LocalDate, LocalTime, LocalDateTime, Instant, Period, and Duration, including a combination of date and time in a single object
Format dates, numbers, and currency values for localization with the NumberFormat and DateFormat classes, including number and date format patterns
Work with dates and times across time zones and manage changes resulting from daylight savings
Lambda
Define and write functional interfaces and describe the interfaces of the java.util.function package
Describe a lambda expression; refactor the code that uses an anonymous inner class to use a lambda expression; describe type inference and target typing
Develop code that uses the built-in interfaces included in the java.util.function package, such as Function, Consumer, Supplier, UnaryOperator, Predicate, and Optional APIs, including the primitive and binary variations of the interfaces
Develop code that uses a method reference, including refactoring a lambda expression to a method reference
Java Streams
Describe the Stream interface and pipelines; create a stream by using the Arrays.stream() and IntStream.range() methods; identify the lambda operations that are lazy
Develop code that uses parallel streams, including decomposition operation and reduction operation in streams
Concurrency
Use classes from the java.util.concurrent package including CyclicBarrier and CopyOnWriteArrayList with a focus on the advantages over and differences from the traditional java.util collections
Use Lock, ReadWriteLock, and ReentrantLock classes in the java.util.concurrent.locks and java.util.concurrent.atomic packages to support lock-free thread-safe programming on single variables
Use Executor, ExecutorService, Executors, Callable, and Future to execute tasks using thread pools
Use the parallel Fork/Join Framework
Java File I/O (NIO.2)
Operate on file and directory paths by using the Paths class
Check, delete, copy, or move a file or directory by using the Files class
Recursively access a directory tree by using the DirectoryStream and FileVisitor interfaces
Find a file by using the PathMatcher interface, and use Java SE 8 I/O improvements, including Files.find(), Files.walk(), and lines() methods
Observe the changes in a directory by using the WatchService interface
Java Collections
Develop code that uses diamond with generic declarations
Develop code that iterates a collection, filters a collection, and sorts a collection by using lambda expressions
Search for data by using methods, such as findFirst(), findAny(), anyMatch(), allMatch(), and noneMatch()
Perform calculations on Java Streams by using count, max, min, average, and sum methods and save results to a collection by using the collect method and Collector class, including the averagingDouble, groupingBy, joining, partitioningBy methods
Develop code that uses Java SE 8 collection improvements, including the Collection.removeIf(), List.replaceAll(), Map.computeIfAbsent(), and Map.computeIfPresent() methods
Develop code that uses the merge(), flatMap(), and map() methods on Java Streams
Assume the following:
Missing package and import statements: If sample code do not include package or import statements, and the question does not explicitly refer to these missing statements, then assume that all sample code is in the same package, or import statements exist to support them.
No file or directory path names for classes: If a question does not state the file names or directory locations of classes, then assume one of the following, whichever will enable the code to compile and run:
All classes are in one file
Each class is contained in a separate file, and all files are in one directory
Unintended line breaks: Sample code might have unintended line breaks. If you see a line of code that looks like it has wrapped, and this creates a situation where the wrapping is significant (for example, a quoted String literal has wrapped), assume that the wrapping is an extension of the same line, and the line does not contain a hard carriage return that would cause a compilation failure.
Code fragments: A code fragment is a small section of source code that is presented without its context. Assume that all necessary supporting code exists and that the supporting environment fully supports the correct compilation and execution of the code shown and its omitted environment.
Descriptive comments: Take descriptive comments, such as “setter and getters go here,” at face value. Assume that correct code exists, compiles, and runs successfully to create the described effect.
QUESTION: 1
Give the code fragment:
Which code fragment, when inserted at line n1, enables the code to print the sum of all the elements in the runs list?
A. return list, Stream () .map (I -> i) sum () ;
B. return list, Stream ( ).mapToint (I -> i). sum () ;
C. return list, Stream () .mapToint(i -> i+ i) . sum();
D. return list, Stream () .map(1-> 1 +1) .sum{) ;
Answer: B
QUESTION: 2
Given the code fragment:
What is the result if the integer aVar is 9?
A. 10 Hello World!
B. Hello Universe!
C. Hello World!
D. Compilation fails.
Answer: A
QUESTION: 3
Give the code fragment:
What is the result?
A. 0 : 1 : 2 : 3 : 4 :
B. 0 : 0 : 0 : 0 : 0 : pen
C. A compilation error occurs.
D. 0 : 1 : pen
E. 0 : 0 : pen
Answer: E
QUESTION: 4
Give the code fragment:
What is the result?
A. word: why what when
B. word: why word: why what word: why what when
C. Compilation fails.
D. word: why word: what word: when
Answer: A