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: Mar 26, 2025
Add To Cart
Question 1

Question ID: UK8291153
Given code of Test.java file:
package com.examtest.ocp;
 
import java.util.ArrayList;
import java.util.List;
 
class Person {
    private String name;
    private int age;
    
    Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    
    public String toString() {
        return "Person[" + name + ", " + age + "]";
    }
    
    public boolean equals(Person obj) {
        if(obj instanceof Person) {
            Person person = (Person)obj;
            if(this.name.equals(person.name) && this.age == person.age) {
                return true;
            }
        }
        return false;
    }
}
 
public class Test {
    public static void main(String[] args) {
        List<Person> persons = new ArrayList<>();
        persons.add(new Person("Liam", 25));
        persons.add(new Person("Liam", 27));
        persons.add(new Person("Liam", 25));
        persons.add(new Person("Liam", 25));
        
        persons.remove(new Person("Liam", 25));
        
        for(Person person : persons) {
            System.out.println(person);
        }
    }
}
What is the result?


Answer: D
Question 2

Question ID: UK8298155
Following statement in a Java program compiles successfully:
student.report(course);
What can you say for sure?


Answer: C
Question 3

Question ID: UK8291167
Given code:
package com.examtest.ocp;
 
interface Message {
    String msg = "CONSISTENCY";
    public default void quoteOfTheDay() {
        record Quote(){ //Line n1
            String combine(String str) {
                return msg + "=" + str; //Line n2
            }
        }
        System.out.println(new Quote().combine("SUCCESS")); //Line n3
    }
}
 
public class Test {
    public static void main(String[] args) {
        new Message(){}.quoteOfTheDay(); //Line n4
    }
}
What is the result?


Answer: A
Question 4

Question ID: UK8291921
Given code of Test.java file:
package com.examtest.ocp;
 
import java.time.*;
 
public class Test {
    public static void main(String [] args) {
        System.out.println(Duration.ofDays(-2));
    }
}
What is the result?


Answer: C
Question 5

Question ID: UK8297291
Consider below code snippet:
var x = Double.valueOf(Math.random() * 10).intValue();
System.out.println(x);
Which of the following statements is correct?


Answer: D
Page:    1 / 132      
Total 660 Questions | Updated On: Mar 26, 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.