EXPERTY DESIGNED 1Z0-829 PRACTICE TEST

Oracle 1Z0-829 Exam Questions
Total Questions: 660
Java SE 17 Developer
Updated On: Nov 11, 2025
Page : 1-66
Question 1

Given code of Test.java file:
package com.examtest.ocp;

public class Test {
    private static String print(String... args) {
        return String.join("-", args); //Line n1
    }
    
    private static Object print(Object... args) {
        String str = "";
        for(Object obj : args) {
            if(obj instanceof String) { //Line n2
                str += (String) obj; //Line n3
            }
        }
        return str; //Line n4
    }
    
    public static void main(String... args) {
        Object obj1 = new String("SPORT"); //Line n5
        Object obj2 = new String("MAD"); //Line n6
        System.out.println(print(obj1, obj2)); //Line n7
    }
}
What is the result?

Options :
Answer: A

Question 2

Question ID: UK8294682
Consider below codes of 3 java files:
//Shrinkable.java
package com.examtest.ocp;
 
public interface Shrinkable {
    public static void shrinkPercentage() {
        System.out.println("80%");
    }
}
//AntMan.java
package com.examtest.ocp;
 
public class AntMan implements Shrinkable { }


//Test.java
package com.examtest.ocp;
 
public class Test {
    public static void main(String[] args) {
        AntMan.shrinkPercentage();
    }
}
Which of the following statements is correct?

Options :
Answer: C

Question 3

Question ID: UK8298565
Consider 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: UK8292097
Below is the code of Test.java file:
package com.examtest.ocp;
 
import java.util.*;
 
public class Test {
    public static void main(String[] args) {
        var list = new ArrayList<>(); //Line n1
        list.add("TAKE");
        list.add("THE");
        list.add("RISK");
 
        System.out.println(String.join(".", list)); //Line n2
    }
}
What is the result?

Options :
Answer: B

Question 5

Question ID: UK8291585
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    public static void main(String[] args) {
        var i = 1;
        var j = 5;
        var k = 0;
        A: while(true) {
            i++;
            B: while(true) {
                j--;
                C: while(true) {
                    k += i + j;
                    if(i == j)
                        break A;
                    else if (i > j)
                        continue A;
                    else 
                        continue B;
                }
            }
        }
        System.out.println(k);
    }
}
What is the result?

Options :
Answer: A

© Copyrights Oracledumps 2025. All Rights Reserved

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