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 12, 2025
Add To Cart
Question 1

Question ID: UK8291985
Consider below code of Test.java file:
package com.examtest.ocp;
 
import java.time.LocalDate;
 
public class Test {
    public static void main(String [] args) {
        LocalDate date = LocalDate.parse("1980-03-16");
        System.out.println(date.minusYears(-5));
    }
}
What is the result?


Answer: B
Question 2

Question ID: UK8297735
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    enum TrafficLight {
        private String message;
        GREEN("go"), AMBER("slow"), RED("stop");
        
        TrafficLight(String message) {
            this.message = message;
        }
        
        public String getMessage() {
            return message;
        }
    }
    
    public static void main(String[] args) {
        System.out.println(TrafficLight.AMBER.getMessage().toUpperCase());
    }
What is the result?


Answer: C
Question 3

Question ID: UK8298152
Consider below code:
package com.examtest.ocp;
 
import java.time.LocalDate;
 
public class Test {
    public static void main(String [] args) {
        LocalDate d1 = LocalDate.parse("1999-09-09");
        LocalDate d2 = LocalDate.parse("1999-09-09");
        LocalDate d3 = LocalDate.of(1999, 9, 9);
        LocalDate d4 = LocalDate.of(1999, 9, 9);
        System.out.println((d1 == d2) + ":" + (d2 == d3) + ":" + (d3 == d4));
    }
}
What is the result?


Answer: D
Question 4

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 5

Question ID: UK8293789
Given 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?


Answer: B
Page:    1 / 132      
Total 660 Questions | Updated On: Nov 12, 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.