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: Jun 05, 2022
Add To Cart
Question 1

Question ID: UK8292486
Given code of Test.java file
package com.examtest.ocp;
public class Test {
    public static < T > T get(T t) {
        return t;
    }
    public static void main(String[] args) {
        String str = get("HELLO");
        System.out.println(str);
    }
}
What is the result?


Answer: A
Question 2

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
Question 3

Question ID: UK8292005
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test<T> {
    private T t;
 
    public T get() {
        return t;
    }
 
    public void set(T t) {
        this.t = t;
    }
 
    public static void main(String args[]) {
        Test obj = new Test();
        obj.set("OCP");
        obj.set(85);
        obj.set('%');
 
        System.out.println(obj.get());
    }
}
What is the result?


Answer: D
Question 4

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?


Answer: D
Question 5

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
Page:    1 / 132      
Total 660 Questions | Updated On: Jun 05, 2022
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.