{"id":81856,"date":"2022-04-13T03:04:10","date_gmt":"2022-04-13T08:34:10","guid":{"rendered":"https:\/\/www.whizlabs.com\/blog\/?p=81856"},"modified":"2023-07-17T18:46:48","modified_gmt":"2023-07-18T00:16:48","slug":"oracle-certified-associate-java-se-8-programmer","status":"publish","type":"post","link":"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/","title":{"rendered":"Free Questions on Oracle Certified Associate, Java SE 8 Programmer (OCAJP 8) &#8211; 1Z0-808"},"content":{"rendered":"<p>This article helps you in the preparation for <a href=\"https:\/\/www.whizlabs.com\/ocajp-scja\/\">Oracle Certified Associate Java SE 8 Programmer<\/a> certification exam. If you are new to java programming, then this is the best Java certification for beginners. By going through these free sample questions on Java SE 8 [1Z0-808] exam, you will be able to learn in detail about the exam objectives.<\/p>\n<p>By learning these Oracle Certified Associate Java SE 8 Programmer exam questions, you can face the actual exam with full confidence. We also provide detailed explanations to every question and answer which enriches your Java domain knowledge as well.<\/p>\n<p>Ok. Let&#8217;s start Learning!<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ea7e02;color:#ea7e02\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ea7e02;color:#ea7e02\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Handling_Exceptions\" >Domain: Handling Exceptions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Handling_Exceptions-2\" >Domain: Handling Exceptions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_with_Methods_and_Encapsulation\" >Domain : Working with Methods and Encapsulation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Using_Operators_and_Decision_Constructs\" >Domain: Using Operators and Decision Constructs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Using_Loop_Constructs\" >Domain : Using Loop Constructs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_with_Inheritance\" >Domain : Working with Inheritance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Creating_and_Using_Arrays\" >Domain : Creating and Using Arrays<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Handling_Exceptions-3\" >Domain : Handling Exceptions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Java_Basics\" >Domain : Java Basics<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Using_Operators_and_Decision_Constructs-2\" >Domain : Using Operators and Decision Constructs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Creating_and_Using_Arrays-2\" >Domain : Creating and Using Arrays<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_with_Inheritance-2\" >Domain : Working with Inheritance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_With_Java_Data_Types\" >Domain : Working With Java Data Types<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Handling_Exceptions-4\" >Domain : Handling Exceptions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_with_Inheritance-3\" >Domain : Working with Inheritance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_with_Methods_and_Encapsulation-2\" >Domain : Working with Methods and Encapsulation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Creating_and_Using_Arrays-3\" >Domain : Creating and Using Arrays<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Using_Operators_and_Decision_Constructs-3\" >Domain : Using Operators and Decision Constructs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_with_Inheritance-4\" >Domain : Working with Inheritance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Creating_and_Using_Arrays-4\" >Domain : Creating and Using Arrays<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Handling_Exceptions-5\" >Domain : Handling Exceptions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_with_Selected_classes_from_the_Java_API\" >Domain : Working with Selected classes from the Java API<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Using_Operators_and_Decision_Constructs-4\" >Domain : Using Operators and Decision Constructs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_With_Java_Data_Types-2\" >Domain : Working With Java Data Types<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Domain_Working_with_Methods_and_Encapsulation-3\" >Domain : Working with Methods and Encapsulation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/www.whizlabs.com\/blog\/oracle-certified-associate-java-se-8-programmer\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Handling_Exceptions\"><\/span><span style=\"font-weight: 400;\">Domain: <\/span><span style=\"font-weight: 400;\">Handling Exceptions<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q1: What will be the result of the below-given code?<\/strong><br \/>\n<strong>public class Test5 {<\/strong><br \/>\n<strong>\u00a0 \u00a0 public static void main(String[] args) {<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0double a = 1, b = 0, c = 2; \/\/ 1<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0 double mod1 = a % b, mod2 = b % c; \/\/ 2<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0 double result = mod1 &gt; mod2 ? mod1 : mod2; \/\/ 3<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0 System.out.println(result);<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0}<\/strong><br \/>\n<strong>}<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>Compiler error<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>Arithmetic Exception<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Prints 0.0<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Prints NaN<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Prints 1.0<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>F. <\/strong>Prints 2.0<\/span><\/p>\n<p><b>Correct Answer: C<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">If we try to find the mod of a floating-point number with zero, NaN is returned. In Java, \u201cNaN\u201d stands for \u201cNot a Number\u201d and NaN constants of both float and double types. As the result of 1 %, 0 is NaN, the value of mod1 is NaN. The remainder of 0 by 2 is 0 itself, here the value of mod2 is returned as 0.0 as it is of type double. As mod1 is not greater than mod2, the value of the result variable will be mod2 itself. Hence, 0.0 is printed.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So <\/span><b>Option C is correct<\/b><span style=\"font-weight: 400;\"> and the others are incorrect.<\/span><br \/>\n<span style=\"font-weight: 400;\">As the code compiles fine,<\/span><b> Option A is incorrect.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">If the numbers were integers instead of floating-point numbers, ArithmeticException would have been thrown instead of &#8220;Nan&#8221;. Hence, option B is incorrect.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Handling_Exceptions-2\"><\/span><span style=\"font-weight: 400;\">Domain: <\/span><span style=\"font-weight: 400;\">Handling Exceptions<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q2: Which of the following will create an appropriate catch block for this given try block?<\/strong><br \/>\n<strong>try { int x = Integer.parseInt(&#8220;one&#8221;); }<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>ClassCastException<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>IllegalStateException<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>IllegalArgumentException<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>ExceptionInInitializerError<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>ArrayIndexOutOfBoundsException<\/span><\/p>\n<p><b>Correct Answer: C\u00a0<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Integer.parseInt can throw a NumberFormatException, and IllegalArgumentException is its superclass (i.e., a broader exception), so we can use it here. Hence, <strong>option C is correct.<\/strong><\/span><br \/>\n<b>Option A is incorrect <\/b><span style=\"font-weight: 400;\">since the ClassCastException is thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance.<\/span><br \/>\n<b>Option D is incorrect<\/b><span style=\"font-weight: 400;\"> since the ExceptionInInitializerError is thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable.<\/span><br \/>\n<span style=\"font-weight: 400;\">IllegalStateException is thrown when java environment or Java application is not in an appropriate state for the requested operation. So, <strong>option B is incorrect.<\/strong><\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/essential\/exceptions\/catch.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/essential\/exceptions\/catch.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_with_Methods_and_Encapsulation\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working with Methods and Encapsulation<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q3 : What will be the output of this program code?<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0public class Whiz {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(int [ ] i) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;main1&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String&#8230; c) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;main2&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String c) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;main3&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0}<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>Main1<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>Main2<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Main3<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>An Error is thrown at the runtime, stating that, Main method not found in class Whiz<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: B<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The signature of the main method must take one form of the following two forms;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">public static void main(String[] args) or public static void main(String\u2026 args)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">And it can also be a final.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">JVM calls main method. When JVM calls main method, it passes a zero length String array if there are no command line arguments passed when running program. So, main method defined at line 5 to 7 will be called. The starting point of a program is the main method; it simply means that the program starts to execute statements which are located inside the main method. So, here \u201cmain2\u201d will be printed. Therefore, <strong>option B is correct.<\/strong><\/span><br \/>\n<b>Options A and C are incorrect<\/b><span style=\"font-weight: 400;\"> as they are not the main method. They are just overloaded versions of the main method and it is legal.<\/span><br \/>\n<b>Option D is incorrect <\/b><span style=\"font-weight: 400;\">as there will be no error thrown as the code has the main method.<\/span><br \/>\n<b>Option E is incorrect <\/b><span style=\"font-weight: 400;\">as the code compiles successfully.<\/span><\/p>\n<p><b>Reference:<\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/getStarted\/application\/index.html\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/getStarted\/application\/index.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Using_Operators_and_Decision_Constructs\"><\/span><span style=\"font-weight: 400;\">Domain: <\/span><span style=\"font-weight: 400;\">Using O<\/span><span style=\"font-weight: 400;\">perators and Decision Constructs<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q4 : Which of the following is true?<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0public class Whiz {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><strong>public static void main(String args [ ]) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><strong>\u00a0\u00a0 int y = 5;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 <\/strong><strong>\u00a0 if (false &amp;&amp; y++==11)<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(y);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else if(true || &#8211;y==4)<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(y);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 else( y==5){}<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0}<\/strong><\/p>\n<p><strong>A. <\/strong><span style=\"font-weight: 400;\">The output will be 6<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>The output will be 4<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>The output will be 5<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>There is no output<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: E<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The code fails due to error on line 11 because we can\u2019t use a conditional clause with else. So, option E is correct.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If we modify line 11 to \u201celse{}\u201d then the code will compile and the first if test \u201cy++==11\u201d will not be checked as we use here &amp;&amp;. So it\u2019ll not print &#8220;y&#8221; at that time. But \u201celse if\u2019s first condition is true it won\u2019t check \u201c\u2014y==4\u201d and it\u2019ll print the value of \u201cy\u201d. Since the value of \u201cy\u201d hasn\u2019t changed the output will be 5. So, the answer would be option C.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/if.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/if.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Using_Loop_Constructs\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Using Loop Constructs<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q5 : Which of the following will compile successfully?<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>for ( int j = 0, int k = 5; j &lt; k; k&#8211; ) ;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>for ( ; ; System.out.print(\u201ca\u201d) ) ;\u00a0<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>for ( );<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>for ( int k = 10; k&#8211;; k &gt; 0 ) ;<\/span><\/p>\n<p><b>Correct Answer: B<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The general syntax of the for loop is;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0for(initialization; Boolean expression; update){ \/* Statements *\/ }<\/span><\/p>\n<p><b>Option B is correct <\/b><span style=\"font-weight: 400;\">as it is displaying the correct syntax. While creating for loops, all three blocks are optional, it simply means that we can skip initialization, boolean expression, or update statements.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It is allowed to write print statements inside the increment\/ decrement part of for loop. The above code compiles fine. As there is no condition to break execution, it becomes an infinite loop.<\/span><\/p>\n<p><b>Try it:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">public class Test {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">public static void main(String[] args) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">for (;; System.out.print(&#8220;a&#8221;));<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><b>Option A is incorrect<\/b><span style=\"font-weight: 400;\">. It is invalid to\u00a0 declare data type two times. It should be\u00a0 for( int j = 0, k = 5; j &lt; k; k&#8211; ) ;\u00a0<\/span><br \/>\n<b>Option C is incorrect<\/b><span style=\"font-weight: 400;\"> as we should use \u201c;\u201d for separating three statements.<\/span><br \/>\n<b>Option D is incorrect<\/b><span style=\"font-weight: 400;\"> because the boolean expression and update statement is in the wrong place.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/for.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/for.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_with_Inheritance\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working with Inheritance<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q6 : What will be the output of this program?<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public class Whiz {<\/strong><\/p>\n<p><strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/strong><strong>public static void main(String args [ ] ) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Move.print();<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0 \u00a0 \u00a0 \u00a0 <\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 interface Move {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 public static void main(String [ ] args) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 System.out.println(&#8220;Move&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 public static void print(){ }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>A. <\/strong><span style=\"font-weight: 400;\">Move<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>No output<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Compilation fails due to an error at line 4<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Compilation fails due to an error at line 8<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails due to multiple errors<\/span><\/p>\n<p><b>Correct Answer: B<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Since Java 8, static methods are allowed in interfaces. main() is a static method. Hence, main() is allowed in interfaces. So, the code compiles successfully. While using Move.print(), the main method in Move interface doesn&#8217;t execute. So, <strong>option B is correct.<\/strong><\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/IandI\/abstract.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/IandI\/abstract.html<\/span><\/a><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Creating_and_Using_Arrays\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Creating and Using Arrays<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q7 : What will be the output of this program?<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public class Whiz{<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><strong>public static void main(String[] args) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><strong>\u00a0int [][]ints = new int[3][2];<\/strong><\/p>\n<p><strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ints[0] = new int[3];<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ints[2] = {1,2,3};<\/strong><\/p>\n<p><strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0System.out.print(ints[0].length + ints[2].length);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>\u00a0\u00a0\u00a0}\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/strong>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>4<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>5<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>6<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>An ArrayIndexOutOfBoundsException is thrown<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: E<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">This code fails to compile due to an error at line 7, because the array constants can only be used in initializers. So, we can\u2019t use \u201c{1,2,3}\u201d at line 7.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/arrays.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/arrays.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Handling_Exceptions-3\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Handling Exceptions<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q8 : What will be the output of this program?<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0class Whiz {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String args[ ]) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 try {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new Whiz().meth();<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } catch(ArithmeticException e) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;Arithmetic&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } finally {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;final 1&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } catch(Exception e) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;Exception&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } finally {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;final 2&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public void meth()throws\u00a0 ArithmeticException {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for(int x = 0; x &lt; 5; x++) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int y = (int) 5\/x;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(x);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0 }<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>Arithmetic final 1<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>Exception final 2<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Arithmetic final 2<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Exception<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: E<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">You can\u2019t have multiple finally clauses. In this code, the first finally clause causes the end of the try clause. So, other catch clause appeared like a catch clause without a try clause, so compilation fails.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/essential\/exceptions\/catch.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/essential\/exceptions\/catch.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Java_Basics\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Java Basics<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><strong>Q9 : which of the following statement compiles successfully?<\/strong><\/h4>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>final int \/ array[] = {1,2,3};<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>final int \/\/ array[] = {1,2,3};<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>final int \u00a0 \/** \u00a0 *\/\u00a0 array[] = \u00a0 {1,2,3} ;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>All of the above<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>None of the above<\/span><\/p>\n<p><b>Correct Answer: C<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">We can have following comments in java<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/* text *\/\u00a0 \u00a0 \u00a0 \u00a0 <\/span> <span style=\"font-weight: 400;\">&#8211;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span> <span style=\"font-weight: 400;\">The compiler ignores everything from \/* to *\/.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/\/ text \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span> <span style=\"font-weight: 400;\">&#8211;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span> <span style=\"font-weight: 400;\">The compiler ignores everything from \/\/ to the end of the line.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\/** documentation *\/\u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This is a documentation comment and in general, it&#8217;s called doc comment. The JDK javadoc tool uses doc comments when preparing automatically generated documentation.<\/span><\/p>\n<p><b>Option C is correct<\/b><span style=\"font-weight: 400;\"> since it doesn\u2019t affect the complete statement.<\/span><br \/>\n<span style=\"font-weight: 400;\"> <strong>Option A is incorrect<\/strong> since using \/ for comments is invalid in java.<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>Option B is incorrect<\/strong> since because of \/\/ the statement will be incomplete.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/getStarted\/application\/index.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/docs.oracle.com\/javase\/tutorial\/getStarted\/application\/index.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Using_Operators_and_Decision_Constructs-2\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Using Operators and Decision Constructs<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q10 : What will be the output of this program?<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public class Whiz {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String [ ] args) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int x = 1;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int y = 10;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 if((x*=3) == y) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.println(y);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 } else {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.println(x);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0}<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>1<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>3<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>10<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Compilation fails due to an error at line 6<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails due to multiple errors<\/span><\/p>\n<p><b>Correct Answer: B<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">At line 6, we have used parentheses to change the value of x. Inside the parentheses, we have used assignment operator which will result in x multiplied by 3. But the condition of the if block won\u2019t be true since the value of y, is 10. Hence, else block executes and print 3, so <strong>option B is correct.<\/strong><\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/if.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/if.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Creating_and_Using_Arrays-2\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Creating and Using Arrays<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q11 : What will be the output of this program?<\/strong><\/p>\n<p><strong>class Whiz {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String args[]) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 new Whiz().iterator(new int [ ]{10,12,13});<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 void iterator(int [ ]i) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for(int x=0;x&lt;i.length;System.out.print(i[x] + &#8221; &#8220;))x++; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<p><strong>A. <\/strong><span style=\"font-weight: 400;\">10 12 13<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>12 13<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>10 12<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>12 13 followed by an exception<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: D<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">We have passed the anonymous array to the iterator method which uses a for loop to iterate through array elements and print them. In given for loop, we have used the printing statement in update part and we have done the increment part inside the loop. So, in the first iteration, it will increase the value of x and then print the second element. But when it does two iteration value of x will become 3, so in final iteration trying to access element will index position 3, will result in an exception. Hence, <strong>option D is correct.<\/strong><\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/for.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/for.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_with_Inheritance-2\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working with Inheritance<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q12 : Which of the following are the benefits of collections over arrays?<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>We can add objects to collections, not to arrays<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>Collections take up less memory than Arrays<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Collections are always thread-safe, while arrays are not<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Collections can grow dynamically, while arrays cannot<\/span><\/p>\n<p><b>Correct Answer: D<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Collections grow and shrink dynamically, whereas arrays are of a fixed size.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Objects can be added to arrays if the object added is an instance of the declared type of the array. Hence, <\/span><b>option A is incorrect.<\/b><br \/>\n<span style=\"font-weight: 400;\">It is not possible to say that collections take less memory or more memory than arrays. Hence, <\/span><b>option B is also incorrect.<\/b><br \/>\n<span style=\"font-weight: 400;\">All collections are not thread-safe. We need to add a synchronization code to ensure thread safety. Hence, <\/span><b>option C is also incorrect.<\/b><\/p>\n<p><b>References: <\/b><a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/collections\/intro\/index.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/docs.oracle.com\/javase\/tutorial\/collections\/intro\/index.html<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/sql\/Statement.html#executeQuery-java.lang.String-\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/sql\/Statement.html#executeQuery-java.lang.String-<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_With_Java_Data_Types\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working With Java Data Types<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q13 : How many objects are eligible for GC (Garbage Collector) when line 10 is reached?<\/strong><\/p>\n<p><strong>class Wrap {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 Double d = 10.0;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 int x = 10; \/\/primitive variable<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 int [ ] s = new int[10];<\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<p><strong>public class Whiz {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String [] args){<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Wrap w =new Wrap();<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 w = null;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/here<\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>1<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>2<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>3<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>4<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: C<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">At line 8, we have created a wrap instance. In that wrapper, there are two objects, one is an array of ints and other is a Double. &#8220;x&#8221; is a primitive variable.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So, making w reference null will result in Wrap object unreachable and also its enclosing two objects. Hence, total three objects eligible for GC. Hence, <\/span><b>option C is correct.<\/b><\/p>\n<p><b>Important:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">&#8220;args&#8221; is not null. It refers to zero length string array if we won&#8217;t pass any command line arguments.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">class Test {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">public static void main(String[] args) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">System.out.println(args.length);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">} }<\/span><\/p>\n<p><b>Output: 0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Since args is not null, it is not eligible for garbage collection.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/javaOO\/usingobject.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/javaOO\/usingobject.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Handling_Exceptions-4\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Handling Exceptions<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q14 : Given the following set of classes:<\/strong><br \/>\n<strong>class A extends Exception {}<\/strong><br \/>\n<strong>class B extends A {}<\/strong><br \/>\n<strong>class C extends B {}<\/strong><br \/>\n<strong>What is the correct sequence of catch blocks for the following try block?<\/strong><br \/>\n<strong>try {<\/strong><br \/>\n<strong>int i = Integer.parseInt(args[0]);<\/strong><br \/>\n<strong>if (i == 0) {<\/strong><br \/>\n<strong>throw new A();<\/strong><br \/>\n<strong>} else if (i == 1) {<\/strong><br \/>\n<strong>throw new C();<\/strong><br \/>\n<strong>}<\/strong><br \/>\n<strong>else if (i == 2) {<\/strong><br \/>\n<strong>throw new B();<\/strong><br \/>\n<strong>}<\/strong><br \/>\n<strong>else<\/strong><br \/>\n<strong>throw new Exception();<\/strong><br \/>\n<strong>}<\/strong><br \/>\n<strong>\/\/ Add catch blocks here<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>Catch Exception, A, B, and C in that order<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>Catch Exception, C, B, and A in that order<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Catch A, B, C, and Exception in that order<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Catch C, B, A, and Exception in that order<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>The order does not matter<\/span><\/p>\n<p><b>Correct Answer: D<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">All the catch blocks corresponding to a try block must be ordered from most specific to most general in the inheritance hierarchy, i.e. catch for NullPointerException must be placed before the catch for Exception because NullPointerException is a subtype of Exception.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">In the given code, C derives from B, B from A, and A from Exception. Hence, C should be positioned first, followed by B, then A, and finally Exception.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">As the right order is C, B, A, and then Exception, <\/span><b>option D is correct<\/b><span style=\"font-weight: 400;\"> and the <\/span><b>other options are incorrect.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The catch blocks will be as below<\/span><\/p>\n<p><span style=\"font-weight: 400;\">catch (C c) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">System.out.println(&#8220;C&#8221;);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">} catch (B b) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">System.out.println(&#8220;B&#8221;);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">} catch (A a) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">System.out.println(&#8220;A&#8221;);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">} catch (Exception e) {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">System.out.println(&#8220;E&#8221;);<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/essential\/exceptions\/catch.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/docs.oracle.com\/javase\/tutorial\/essential\/exceptions\/catch.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_with_Inheritance-3\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working with Inheritance<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q15 : Which will compile successfully when inserted at line 3?<\/strong><\/p>\n<p><strong>abstract interface Movable{<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int x = 10;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/insert code here<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 void run();<\/strong><\/p>\n<p><strong>\u00a0}<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>private int x = 10;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>abstract int i = 5;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>final static float\u00a0 c = 6.0;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>final short s=10;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>None of the above<\/span><\/p>\n<p><b>Correct Answer: D<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><b>Option A is incorrect <\/b><span style=\"font-weight: 400;\">since at line 2 we already defined a variable calls \u2018x\u2019 so we can\u2019t have another variable with the same name in the same scope. Also, the private variables are not allowed in interfaces.<\/span><br \/>\n<b>Option B is incorrect <\/b><span style=\"font-weight: 400;\">as an abstract modifier is not valid for a variable.<\/span><br \/>\n<b>Option C is incorrect <\/b><span style=\"font-weight: 400;\">since float literal should be ended with \u2018f\u2019 when it has decimal points.<\/span><br \/>\n<b>Option D is correct<\/b><span style=\"font-weight: 400;\"> as we can assign int literal within the range of -32768 \u2013 32767 to a short.<\/span><\/p>\n<p><b>Reference:<\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/variables.html\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/variables.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_with_Methods_and_Encapsulation-2\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working with Methods and Encapsulation<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q16 : What will be the output of this program?<\/strong><\/p>\n<p><strong>class Whiz{<\/strong><\/p>\n<p><strong>final int i;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/strong><strong>\u00a0 public static void main(String args[]){<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Whiz s= new Whiz();<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.println( &#8220;i = &#8220;+s.i);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>Prints i = 0<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>Prints i = 1<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Prints i = Null<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Runtime Exception is thrown<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compile-time Error<\/span><\/p>\n<p><b>Correct Answer: E<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The compiler complains \u201cvariable i has not been initialized in the default constructor&#8221;. A final variable is equivalent to a constant entity in java. Once it is initialized it may not be changed. But, it has to be initialized at the time of declaration. It can be initialized in 3 ways.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A final variable is initialized at the time of declaration<\/span><\/p>\n<p><span style=\"font-weight: 400;\">final int i=100;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It can be initialized in the constructor<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Whiz(){i=100;}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It can be initialized in instance block of initialization<\/span><\/p>\n<p><b>Reference:<\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/variables.html\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/variables.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Creating_and_Using_Arrays-3\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Creating and Using Arrays<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q17 : Which of the following can be used to iterate through all elements of this array?<\/strong><br \/>\n<strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 double [] dlbs = {1,5.1,2.0,7};<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>for(double d : double dlbs[]){ }<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>for(double d ; dlbs){ }<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>for(dbs ; dlbs){ }<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>for(dbs : double dlbs){ }<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>for(double d : dlbs){ }<\/span><\/p>\n<p><b>Correct Answer: E<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Syntax for enhanced for loop is<\/span><\/p>\n<p><span style=\"font-weight: 400;\">for([data type] [name] : [array or collection name])<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So in given options, only E follows correct syntax.<\/span><\/p>\n<p><b>Options A, C, and D are incorrect <\/b><span style=\"font-weight: 400;\">as it is invalid syntax in collection name area. Option B is incorrect because we need to use a colon, not the semi-colon.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/for.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/for.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Using_Operators_and_Decision_Constructs-3\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Using Operators and Decision Constructs<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q18 : Consider this given program code and choose the correct option.<\/strong><\/p>\n<p><strong>\u00a0\u00a0class Whiz {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String args[ ]) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 final int i = 0;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 final int j;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 j=2;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 int x= (int)(Math.random() * 3);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 switch(x) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 case i : {System.out.print(&#8220;A&#8221;);}<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 case 1: System.out.print(&#8220;B&#8221;);break;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 case j : System.out.print(&#8220;C&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0}\u00a0<\/strong><\/p>\n<p><strong>Note: Math.random() * 3 will assign value 0,1 or\u00a0 2.x\u00a0 .<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>The output will be A<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>The output will be AB<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>The output will be B<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>The output will be BC<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: E<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">A case constant must be a compile-time constant. Here integer j is not a compile time constant.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/switch.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/switch.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_with_Inheritance-4\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working with Inheritance<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q19 : What will be the output of this program?<\/strong><\/p>\n<p><strong>class MainClass{<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 MainClass(){ System.out.print(&#8220;MainClass &#8220;);\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<p><strong>class SubClass extends MainClass{<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {System.out.print(&#8220;I &#8220;);}<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 static{System.out.print(&#8220;S &#8220;);}<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SubClass(int i){<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 this();<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 System.out.print(&#8220;SubClass &#8220;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0 <\/strong><strong>SubClass(){<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 super();<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;SubClass &#8220;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0}<\/strong><\/p>\n<p><strong>public class SubSubClass extends SubClass{<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SubSubClass(String s){<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 super();<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 System.out.print(&#8220;SubSubClass &#8220;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String [] args){<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 new SubSubClass(&#8220;ABC&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0}<\/strong><\/p>\n<p><strong>A. <\/strong><span style=\"font-weight: 400;\">MainClass S I SubClass SubSubClass<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>S MainClass I SubClass SubSubClass<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>S MainClass I SubClass SubClass SubSubClass<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>SubSubClass SubClass S I MainClass<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: B<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">To get the correct answer, you should know, Static initialization blocks run once when the class is first loaded. Instance initialization blocks run every time a new instance is created. They run after all super-constructors and before the constructor\u2019s code have run.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here first &#8216;S&#8217; will be printed as the static block executes when the class is loading,\u00a0 then at line 23 when the instance of SubSubClass is created, last super class constructor in the class hierarchy which is MainClass will be executed and print &#8220;MainClass&#8221;. When it comes to next subclass it will first execute non-static code block and then its constructor, so &#8220;I&#8221; and &#8220;SubClass&#8221; will print. Finally, the SubSubclass constructor will execute and print &#8216;SubSubClass&#8217;. Hence, <strong>option B is correct.<\/strong><\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/javaOO\/arguments.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/javaOO\/arguments.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Creating_and_Using_Arrays-4\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Creating and Using Arrays<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q20 : Which of the following will print 4 as the output when inserted at line 4?<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>\u00a0public class Whizlab{<\/strong><\/span><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String[] args) {<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int [][]array = {{},{1,2,3}, {4,5}};<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/ insert here<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/strong><\/p>\n<p><strong>A. <\/strong><span style=\"font-weight: 400;\">System.out.print(array[2][2]);<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>System.out.print(array[1][2]);<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>System.out.print(array[3][2]);<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>System.out.print(array[2][0]);<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>System.out.print(array[2][1]);<\/span><\/p>\n<p><b>Correct Answer: D<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Array indexes are started from 0. So, we can summarize the array content as follows:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">array[0] &gt; empty array<\/span><\/p>\n<p><span style=\"font-weight: 400;\">array[1] &gt; {1,2,3} &gt; array[1][0] = 1 &#8230;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">array[2] &gt; {4,5} &gt; array[2][0] = 4 &#8230;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So, to get an expected output, we need to access the first element of the third one-dimensional array. So, it should be array[2][0], hence <strong>option D is correct.<\/strong><\/span><\/p>\n<p><b>Reference:<\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/arrays.html\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/arrays.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Handling_Exceptions-5\"><\/span>Domain : Handling Exceptions<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q21 : What will be the output of this program?\u00a0 java\u00a0 Whizlab\u00a0 10<\/strong><\/p>\n<p><strong>class Whizlab {<\/strong><strong>\u00a0 \u00a0 \u00a0\u00a0<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 public static void main(String args[]) {\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 try {<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 System.out.println(args[0]);<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }catch (ArrayIndexOutOfBoundsException | ArithmeticException | NullPointerException e) {<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (e instanceof ArrayIndexOutOfBoundsException) {<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 e = new ArrayIndexOutOfBoundsException(&#8220;Out of bounds&#8221;);<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } else if(e instanceof NullPointerException) {<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 e = new NullPointerException(&#8220;Null Value&#8221;);<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } else {<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 e = new ArithmeticException(&#8220;Arithmetic&#8221;);<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 System.out.println(e.getMessage());<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>}\u00a0 \u00a0 \u00a0<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 <\/span> <strong>}<\/strong><\/p>\n<p><strong> \u00a0 \u00a0 }<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>Null<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>Null Value<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Arithmetic<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Out of bounds<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Arithmetic Null<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>F. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: F<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">When we are using the multi catch block, the exception variable is implicitly final, therefore we cannot assign the variable to different value within the catch block. So, here trying to assign different exceptions to exception variable results a compile time error; hence <strong>option F is correct.<\/strong><\/span><\/p>\n<p><b>References: <\/b><a href=\"http:\/\/www.oracle.com\/technetwork\/articles\/java\/java7exceptions-486908.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/www.oracle.com\/technetwork\/articles\/java\/java7exceptions-486908.html<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/docs.oracle.com\/javase\/specs\/jls\/se7\/html\/jls-14.html#jls-14.20\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/docs.oracle.com\/javase\/specs\/jls\/se7\/html\/jls-14.html#jls-14.20<\/span><\/a><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_with_Selected_classes_from_the_Java_API\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working with Selected classes from the Java API<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q22 : What will be the output of this program?<\/strong><\/p>\n<p><strong>public class Whizlab{<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0public static void main(String [ ] args){\u00a0 <\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 StringBuilder sb = new StringBuilder(&#8220;Whiz&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 sb = sb.append(&#8220;lab&#8221;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 sb.append(&#8216;s&#8217;);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 sb.setLength(7);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 System.out.println(sb);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0}\u00a0 <\/strong><\/p>\n<p><strong>}\u00a0\u00a0\u00a0<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>Whizlabs<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>Whizlab<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>Whiz<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>Whizla<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Does not compile<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>F. <\/strong>An Exception will be thrown<\/span><\/p>\n<p><b>Correct Answer: B<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">StringBuilder is a mutable sequence of characters, which means that any changes made to it will be reflected in the instance. In line 4, assigning the modified instance to the reference variable is not necessary as the changes will take effect even if the assignment does not happen.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here, the first and second append statements will append &#8220;lab&#8221; and then &#8220;s&#8221; to the sequence &#8220;Whiz&#8221;. Hence, in line 6, the StringBuilder instance will hold \u2018Whizlabs\u2019 as content. After that, the setLength() call will trim the letters after the 7th character. So the final output is \u2018Whizlab\u2019.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So, <\/span><b>Option B is correct <\/b><span style=\"font-weight: 400;\">and the other options are incorrect.<\/span><br \/>\n<span style=\"font-weight: 400;\">The code compiles fine since the append() method also returns a StringBuilder. Hence, <strong>option E is incorrect.<\/strong><\/span><\/p>\n<p><b>Reference: <\/b><a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/lang\/StringBuilder.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/lang\/StringBuilder.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Using_Operators_and_Decision_Constructs-4\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Using Operators and Decision Constructs<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q23 : What will be the output of this program?<\/strong><\/p>\n<p><strong>class Whizlab{<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public static void main(String [] args){<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 int y=10;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 int x = 10;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 if(x!=10 &amp;&amp; y++==1);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 if(y==11 | ++x==11) y+=10;<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 System.out.print(y);<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/strong><\/p>\n<p><strong>}<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>11<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>10<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>20<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>21<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>Compilation fails<\/span><\/p>\n<p><b>Correct Answer: C<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">At line 5, y++ won\u2019t execute as x!=10 is false (A short circuit is used). But at the next line ++x=11 so y+=10; will execute and make y=20.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/operators.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/operators.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_With_Java_Data_Types-2\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working With Java Data Types<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q24 : Which of the following will compile without errors?<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A.<\/strong> short s = 10000;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B.<\/strong> float f = 2.0;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C.<\/strong> int n = &#8220;hello&#8221;.length();<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D.<\/strong> long l = 0.0\/10;<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E.<\/strong> long m = &#8220;hello&#8221;.length;<\/span><\/p>\n<p><b>Correct Answers: A and C<\/b><\/p>\n<p><b>Explanation<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The short data type is a 16-bit signed two&#8217;s complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). When the 100000 is assigned to short type, a narrowing conversion happens.<\/span> <span style=\"font-weight: 400;\">Hence,<\/span><b> option A is correct.<\/b><br \/>\n<span style=\"font-weight: 400;\">A floating-point literal is of type double by default. Hence, it cannot be assigned to a float variable without casting, hence<\/span><b> option B will cause a compiler error. So it is incorrect.<\/b><br \/>\n<span style=\"font-weight: 400;\">In option C, the length() method of String is invoked to get the number of characters in the String. Hence,<\/span><b> option C is also correct.<\/b><br \/>\n<span style=\"font-weight: 400;\">The division of 0.0 by 10 results in a double value, which cannot be assigned to a long variable without casting, hence<\/span><b> option D will cause a compiler error. So it is incorrect.<\/b><br \/>\n<b>Option E is incorrect<\/b><span style=\"font-weight: 400;\"> because length is a method of String and it cannot be invoked without parenthesis.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/datatypes.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/datatypes.html<\/span><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Domain_Working_with_Methods_and_Encapsulation-3\"><\/span><span style=\"font-weight: 400;\">Domain : <\/span><span style=\"font-weight: 400;\">Working with Methods and Encapsulation<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>Q25 : Which of the following are the correct syntax to overload the method on line 4? (Choose three options)<\/strong><br \/>\n<strong>\u2026<\/strong><\/p>\n<p><strong> public void greet(String greeting) {<\/strong><\/p>\n<p><strong> \/* more codes *\/<\/strong><\/p>\n<p><strong> }<\/strong><\/p>\n<p><strong>\u2026<\/strong><\/p>\n<p><span style=\"font-weight: 400;\"><strong>A. <\/strong>public String greet() {\/\/more codes}<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>B. <\/strong>public void greet(String greeting, String name) {}<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>C. <\/strong>public void greet(Object greeting) {}<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>D. <\/strong>private void greet(String greeting) {}<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>E. <\/strong>private String greet(String greet) {}\u00a0<\/span><\/p>\n<p><b>Correct Answers: A, B and C<\/b><\/p>\n<p><b>Explanation\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Method overloading is determined by the number and type of the arguments and not by the return type or access or non-access modifiers.<\/span><\/p>\n<p><b>Options A, B, and C are correct <\/b><span style=\"font-weight: 400;\">because the argument is different in all these three methods.<\/span><br \/>\n<b>Option D is incorrect <\/b><span style=\"font-weight: 400;\">because the argument is the same. Changing the access modifier has no impact on overloading.<\/span><br \/>\n<b>Option E is incorrect<\/b><span style=\"font-weight: 400;\"> because the type and number of argument\/s are the same. Changing the return type or the access modifier has no impact on overloading.<\/span><\/p>\n<p><b>Reference: <\/b><a href=\"http:\/\/docs.oracle.com\/javase\/tutorial\/java\/javaOO\/methods.html\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">http:\/\/docs.oracle.com\/javase\/tutorial\/java\/javaOO\/methods.html<\/span><\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Hope you are able to understand the exam topics for Oracle Certified Associate Java SE 8 Programmer certification. You should also try on practice tests which are a kind of quiz to test your skills. If you spend more time on learning, then you are able to pass the exam in the first attempt itself. Keep learning !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article helps you in the preparation for Oracle Certified Associate Java SE 8 Programmer certification exam. If you are new to java programming, then this is the best Java certification for beginners. By going through these free sample questions on Java SE 8 [1Z0-808] exam, you will be able to learn in detail about the exam objectives. By learning these Oracle Certified Associate Java SE 8 Programmer exam questions, you can face the actual exam with full confidence. We also provide detailed explanations to every question and answer which enriches your Java domain knowledge as well. Ok. Let&#8217;s start [&hellip;]<\/p>\n","protected":false},"author":359,"featured_media":82085,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[13],"tags":[4861],"class_list":["post-81856","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","tag-oracle-certified-associate-java-se-8-programmer"],"uagb_featured_image_src":{"full":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",600,315,false],"thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam-150x150.webp",150,150,true],"medium":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam-300x158.webp",300,158,true],"medium_large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",600,315,false],"large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",600,315,false],"1536x1536":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",600,315,false],"2048x2048":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",600,315,false],"profile_24":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",24,13,false],"profile_48":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",48,25,false],"profile_96":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",96,50,false],"profile_150":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",150,79,false],"profile_300":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",300,158,false],"tptn_thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam-250x250.webp",250,250,true],"web-stories-poster-portrait":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",600,315,false],"web-stories-publisher-logo":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",96,50,false],"web-stories-thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/04\/Free-Questions-on-Oracle-Certified-Associate-Java-SE-8-Programmer-OCAJP-8-\u2013-1Z0-808-Certification-Exam.webp",150,79,false]},"uagb_author_info":{"display_name":"Abilesh Premkumar","author_link":"https:\/\/www.whizlabs.com\/blog\/author\/abilesh\/"},"uagb_comment_info":9,"uagb_excerpt":"This article helps you in the preparation for Oracle Certified Associate Java SE 8 Programmer certification exam. If you are new to java programming, then this is the best Java certification for beginners. By going through these free sample questions on Java SE 8 [1Z0-808] exam, you will be able to learn in detail about&hellip;","_links":{"self":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/81856","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/users\/359"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/comments?post=81856"}],"version-history":[{"count":15,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/81856\/revisions"}],"predecessor-version":[{"id":89925,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/81856\/revisions\/89925"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media\/82085"}],"wp:attachment":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media?parent=81856"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/categories?post=81856"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/tags?post=81856"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}