Exam Code: 1Z0-829
Exam Questions: 660
Java SE 17 Developer
Updated: 20 Feb, 2026
Viewing Page : 1 - 66
Practicing : 1 - 5 of 660 Questions
Question 1

Question ID: UK8293789Given code of Test.java file:package com.examtest.ocp; class Base {    public void log() throws NullPointerException {        System.out.println("Base: log()");    }} class Derived extends Base {    public void log() throws RuntimeException {        System.out.println("Derived: log()");    }} public class Test {    public static void main(String[] args) {        Base obj = new Derived();        obj.log();    }}What is the result?

Options :
Answer: B

Question 2

Question ID: UK8298141Consider below 3 statements:1. System.out.println(700 * Math.pow(2, -2));2. System.out.println(700 * (1 / 4));3. System.out.println(7 * Math.ceil(24.80));Do all the three statements produce same output?

Options :
Answer: B

Question 3

Question ID: UK8298565Consider below code of Test.java file:package com.examtest.ocp;  public class Test {    public static void main(String[] args) {        String str = "*";        /*INSERT*/        System.out.println(str);    }}Which of the following options, if used to replace /*INSERT*/, will compile successfully and on execution will print ***** on to the console?Choose 2 options.

Options :
Answer: A,B

Question 4

Question ID: UK8297279Consider below code of Test.java file:package com.examtest.ocp; public class Test {    public static void main(String [] args) {        boolean flag1 = true;        boolean flag2 = false;        boolean flag3 = true;        boolean flag4 = false;                System.out.println(!flag1 == flag2 != flag3 == !flag4); //Line n1        System.out.println(flag1 = flag2 != flag3 == !flag4); //Line n2    }}What is the result?

Options :
Answer: A

Question 5

Question ID: UK8296889Given code of Test.java file:package com.examtest.ocp; class GrandParent {} class Parent extends GrandParent {} class Child extends Parent {} class GrandChild extends Child {} public class Test {    public static void main(String... args) {        GrandParent obj = new Child();        if(!(obj instanceof GrandChild gc)) {            System.out.print("Not a GrandChild");            /*INSERT-1*/        }         /*INSERT-2*/        System.out.println(gc); //Line n2    }}And the statements:1. Above code causes compilation error2. Above code compiles successfully and prints: Not a GrandChild3. To resolve compilation error, replace /*INSERT-1*/ with return;4. To resolve compilation error, replace /*INSERT-2*/ with elseHow many of the above statements is/are correct?

Options :
Answer: C

Viewing Page : 1 - 66
Practicing : 1 - 5 of 660 Questions

© Copyrights FreePDFQuestions 2026. All Rights Reserved

We use cookies to ensure that we give you the best experience on our website (FreePDFQuestions). If you continue without changing your settings, we'll assume that you are happy to receive all cookies on the FreePDFQuestions.