EXPERTY DESIGNED 1Z0-829 PRACTICE TEST

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

Question ID: UK8295518
How many of the below code statements, written inside main method will compile successfully?
1. var arr1 = new int[]{10};
2. var arr2 = new String[][] {};
3. var arr3 = new char[][] {{}};
4. var arr4 = {10, 20, 30};
5. var arr5 = new String[][] {new String[]{"LOOK"}, new String[] {"UP"}};
6. var [] arr6 = new int[] {2, 3, 4};

Options :
Answer: A

Question 2

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 3

Question ID: UK8295509
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    public static void main(String[] args) {
        String arr1 [], arr2, arr3 = null; //Line n1
        arr1 = new String[2];
        arr1[0] = "A";
        arr1[1] = "B";
        arr2 = arr3 = arr1; //Line n2
        System.out.println(String.join("-", arr2)); //Line n3
    }
}
What is the result?

Options :
Answer: B

Question 4

Question ID: UK8295123
Given code of Test.java file:
package com.examtest.ocp;
 
import java.util.ArrayList;
import java.util.List;
 
public class Test {
    public static void main(String[] args) {
        List<Character> list = new ArrayList<>();
        list.add(0, 'E');
        list.add('X');
        list.add(1, 'P');
        list.add(3, 'O');
        
        if(list.contains('O')) {
            list.remove('O');
        }
        
        for(char ch : list) {
            System.out.print(ch);
        }
    }
}
What is the result?

Options :
Answer: B

Question 5

Question ID: UK8291953
Consider below code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    public static void main(String [] args) {
        var text = """
            I gave him $200 and \
            he returned me €120, \
            so I am left with £80.""";
 
        System.out.println(
            text.transform(Test::removeCurrencySymbols)
                .transform(String::toUpperCase)
                .formatted("¥", "¥", "¥"));
    }
 
    private static String removeCurrencySymbols(String s) {
        return s.replaceAll("\\$", "%s")
                .replaceAll("€", "%s")
                .replaceAll("£", "%s");
    }
}
What is the result?

Options :
Answer: B

© 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.