Chapter 8. Full mock exam

 

This chapter covers

  • Complete mock exam with 77 questions
  • Answers to all mock exam questions with extensive explanations and the subobjective on which each exam question is based

On the real exam, each question displays the count of correct options that you should select. The exam engine won’t allow you to select more answer options than are specified by this number. If you try to do so, a warning will be displayed. The questions in this mock exam also specify the correct number of answer options to align it more closely with the real exam.

8.1. Mock exam

ME-Q1)

Given the following definition of the classes Animal, Lion, and Jumpable, select the correct combinations of assignments of a variable that don’t result in compilation errors or runtime exceptions (select 2 options).

interface Jumpable {}
class Animal {}
class Lion extends Animal implements Jumpable {}
  1. Jumpable var1 = new Jumpable();
  2. Animal var2 = new Animal();
  3. Lion var3 = new Animal();
  4. Jumpable var4 = new Animal();
  5. Jumpable var5 = new Lion();
  6. Jumpable var6 = (Jumpable)(new Animal());

ME-Q2)

Given the following code, which option, if used to replace /* INSERT CODE HERE */, will make the code print 1? (Select 1 option.)

try {
    String[][] names = {{"Andre", "Mike"}, null, {"Pedro"}};
    System.out.println (names[2][1].substring(0, 2));
} catch (/*INSERT CODE HERE*/) {
    System.out.println(1);
}

8.2. Answers to mock exam questions

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage