×

Special Offer! Black Friday Price Drop! Extra 20% OFF- Ends In  Coupon code: DG2020

Free Oracle 1Z0-829 Exam Questions

Become Oracle Certified with updated 1Z0-829 exam questions and correct answers

Page:    1 / 132      
Total 660 Questions | Updated On: Nov 24, 2025
Add To Cart
Question 1

Question ID: UK8296889
Given 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 error
2. Above code compiles successfully and prints: Not a GrandChild
3. To resolve compilation error, replace /*INSERT-1*/ with return;
4. To resolve compilation error, replace /*INSERT-2*/ with else
How many of the above statements is/are correct?


Answer: C
Question 2

Question ID: UK8297700
Consider below code of Test.java file:
package com.examtest.ocp;
 
class Parent {
    int i = 10;
    Parent(int i) {
        super();
        this.i = i;
    }
}
 
class Child extends Parent {
    int j = 20;
    
    Child(int j) {
        super(0);
        this.j = j;
    }
    
    Child(int i, int j) {
        super(i);
        this(j);
    }
    
}
 
public class Test {
    public static void main(String[] args) {
        Child child = new Child(1000, 2000);
        System.out.println(child.i + ":" + child.j);
    }
}
What is the result?


Answer: C
Question 3

Question ID: UK8298570
Consider below code of Test.java file:
package com.examtest.ocp; 
 
public class Test extends String {
    @Override
    public String toString() {
        return "TEST";
    }
    
    public static void main(String[] args) {
        Test obj = new Test();
        System.out.println(obj);
    }
}
What is the result?


Answer: D
Question 4

Question ID: UK8295901
Consider below code:
package com.examtest.ocp;
 
public class Test {
    static Double d1;
    static int x = d1.intValue();
    
    public static void main(String[] args) {
        System.out.println("HELLO");
    }
}
On execution, does Test class print HELLO on to the console?


Answer: B
Question 5

Question ID: UK8297257
Given code of Test.java file:

package com.examtest.ocp;
 
public class Test {
    public static void main(String[] args) {
        int x = 2;
        switch (x) {
            default:
                System.out.println("Still no idea what x is");
            case 1:
                System.out.println("x is equal to 1");
                break;
            case 2:
                System.out.println("x is equal to 2");
                break;
            case 3: 
                System.out.println("x is equal to 3");
                break;
        }
    }
}
What is the result?


Answer: A
Page:    1 / 132      
Total 660 Questions | Updated On: Nov 24, 2025
Add To Cart

© Copyrights DumpsCertify 2025. All Rights Reserved

We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the DumpsCertify.