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

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 2

Question ID: UK8295506
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    public static void main(String[] args) {
        String[] arr = { "L", "I", "V", "E" }; //Line n1
        int i = -2;
 
        if (i++ == -1) { //Line n2
            arr[-(--i)] = "F"; //Line n3
        } else if (--i == -2) { //Line n4
            arr[-++i] = "O"; //Line n5
        }
 
        System.out.println(String.join("", arr)); //Line n6
    }
}
What is the result?


Answer: A
Question 3

Question ID: UK8291513
Given 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.ofEpochDay(1);
        System.out.println(date);
    }
}
What is the result?


Answer: B
Question 4

Question ID: UK8291577
Given code of Test.java file:
package com.examtest.ocp; 
 
public class Test {
    public static void main(String[] args) {
        for:
        for (int i = 2; i <= 100; i = i + 2) {
            for(int j = 1; j <= 10; j++) {
                System.out.print(i * j + "\t");
            }
            System.out.println();
            if(i == 10) {
                break for;
            }
        }
    }
}
What is the result?


Answer: A
Question 5

Question ID: UK8291982
Consider below code of Test.java file:
package com.examtest.ocp;
 
import java.time.LocalDate;
 
class MyLocalDate extends LocalDate {
    @Override
    public String toString() {
        return super.getDayOfMonth() + "-" + super.getMonthValue() + "-" +  super.getYear();
    }
}
 
public class Test {
    public static void main(String [] args) {
        MyLocalDate date = LocalDate.parse("1980-03-16");
        System.out.println(date);
    }
}
What is the result?


Answer: A
Page:    1 / 132      
Total 660 Questions | Updated On: Feb 20, 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.