Free Java SE 8 Programmer II 1Z0-809 Exam Practice Test
1Z0-809 Exam Features
In Just $59 You can Access
- All Official Question Types
- Interactive Web-Based Practice Test Software
- No Installation or 3rd Party Software Required
- Customize your practice sessions (Free Demo)
- 24/7 Customer Support
Total Questions: 196
-
Given:IntStream stream = IntStream.of (1,2,3);IntFunction<Integer> inFu= x -> y -> x*y;//line n1IntStream newStream = stream.map(inFu.apply(10));//line n2newStream.forEach(System.out::print);Which modification enables the code fragment to compile?
Answer: 2 Next Question -
Given the code fragment:public static void main (String[] args) throws IOException {BufferedReader brCopy = null;try (BufferedReader br = new BufferedReader (new FileReader(''employee.txt''))) { //line n1br.lines().forEach(c -> System.out.println(c));brCopy = br;//line n2}brCopy.ready(); //line n3;}Assume that the ready method of the BufferedReader, when called on a closed BufferedReader, throws an exception, and employee.txt is accessible and contains valid text.What is the result?
Answer: 4 Next Question -
Given:class Bird {public void fly () { System.out.print(''Can fly''); }}class Penguin extends Bird {public void fly () { System.out.print(''Cannot fly''); }}and the code fragment:class Birdie {public static void main (String [ ] args) {fly( ( ) -> new Bird ( ));fly (Penguin : : new);}/* line n1 */}Which code fragment, when inserted at line n1, enables the Birdie class to compile?
Answer: 3 Next Question -
Which two statements are true about synchronization and locks? (Choose two.)
Answer: 1, 2 Next Question -
Given:class RateOfInterest {public static void main (String[] args) {int rateOfInterest = 0;String accountType = ''LOAN'';switch (accountType) {case ''RD'';rateOfInterest = 5;break;case ''FD'';rateOfInterest = 10;break;default:assert false: ''No interest for this account''; //line n1}System.out.println (''Rate of interest:'' + rateOfInterest);}}and the command:java --ea RateOfInterestWhat is the result?
Answer: 2 Next Question -
Given:class UserException extends Exception { }class AgeOutOfLimitException extends UserException { }and the code fragment:class App {public void doRegister(String name, int age)throws UserException, AgeOutOfLimitException {if (name.length () < 6) {throw new UserException ();} else if (age >= 60) {throw new AgeOutOfLimitException ();} else {System.out.println(''User is registered.'');}}public static void main(String[ ] args) throws UserException {App t = new App ();t.doRegister(''Mathew'', 60);}}What is the result?
Answer: 2 Next Question -
Given the code fragments:public class Book implements Comparator<Book> {String name;double price;public Book () {}public Book(String name, double price) {this.name = name;this.price = price;}public int compare(Book b1, Book b2) {return b1.name.compareTo(b2.name);}public String toString() {return name + '':'' + price;}}andList<Book>books = Arrays.asList (new Book (''Beginning with Java'', 2), new book (''AGuide to Java Tour'', 3));Collections.sort(books, new Book());System.out.print(books);What is the result?
Answer: 1 Next Question -
Given the code fragment:List<Double> doubles = Arrays.asList (100.12, 200.32);DoubleFunction funD = d --> d + 100.0;doubles.stream (). forEach (funD); // line n1doubles.stream(). forEach(e --> System.out.println(e)); // line n2What is the result?
Answer: 1 Next Question -
Given the code fragment:List<Integer> codes = Arrays.asList (10, 20);UnaryOperator<Double> uo = s -> s +10.0;codes.replaceAll(uo);codes.forEach(c -> System.out.println(c));What is the result?
Answer: 3 Next Question -
What is true about the java.sql.Statement interface?
Answer: 4 Next Question
Total Questions: 196
