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

Question ID: UK8294624
Given code:
package com.examtest.ocp;
 
class Outer {
    private String msg = "A";
    public void print() {
        final String msg = "B";
        class Inner {
            public void print() {
                System.out.println(this.msg);
            }
        }
        Inner obj = new Inner();
        obj.print();
    }
}
 
public class Test {
    public static void main(String[] args) {
        new Outer().print(); 
    }
}
What is the result?


Answer: A
Question 2

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?


Answer: B
Question 3

Question ID: UK8291549
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    private static void m(int i) {
        System.out.print(1);
    }
    
    private static void m(int i1, int i2) {
        System.out.print(2);
    }
    
    private static void m(char... args) {
        System.out.print(3);
    }
   
    public static void main(String... args) {
        m('A');
        m('A', 'B');
        m('A', 'B', 'C');
        m('A', 'B', 'C', 'D');
    }
}
What is the result?


Answer: C
Question 4

Question ID: UK8296388
Consider below code of Test.java file:
package com.examtest.ocp; 
 
public class Test {
    public static void main(String[] args) {
        final var str = "+";
        System.out.println(str.repeat(2) == "++");
    }
}
What is the result?


Answer: B
Question 5

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};


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