×

Special Offer! Black Friday + Cyber Monday Sale! Extra 20% OFF - Ends In Coupon code: HELLO20OFF

Free 1Z0-829 Mock Exam – Practice Online Confidently

Increase your chances of passing the Oracle 1Z0-829 exam questions on your first try. Practice with our free online 1Z0-829 exam mock test designed to help you prepare effectively and confidently.

Exam Code: 1Z0-829
Exam Questions: 660
Java SE 17 Developer
Updated: 25 Nov, 2025
Question 1

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?

Options :
Answer: A

Question 2

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 3

Question ID: UK8294645
Given code of Test.java file:
package com.examtest.ocp;
 
import java.io.IOException;
import java.sql.SQLException;
 
class MyResource implements AutoCloseable {
    @Override
    public void close() throws IOException{
        throw new IOException("IOException");
    }
 
    public void execute() throws SQLException {
        throw new SQLException("SQLException");
    }
}
 
public class Test {
    public static void main(String[] args) {
        try(MyResource resource = new MyResource()) {
            resource.execute();
        } catch(Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
What is the result?

Options :
Answer: 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: UK8292410
Consider below code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    public static void main(String[] args) {
        Boolean b = Boolean.valueOf("tRUe");
        switch(b) {
            case true:
                System.out.println("ONE");
            case false:
                System.out.println("TWO");
            default: 
                System.out.println("THREE");
        }
    }
}
What is the result of compiling and executing Test class?

Options :
Answer: D

Viewing Page : 1 - 66
Practicing : 1 - 5 of 660 Questions

© Copyrights FreeMockExams 2025. All Rights Reserved

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