1Z0-829 Practice Online

Quickly grab our 1Z0-829 product now and kickstart your exam preparation today!

Name: Java SE 17 Developer
Exam Code: 1Z0-829
Certification: Oracle Java
Vendor: Oracle
Total Questions: 660
Last Updated: Apr 24, 2024
Page:    1 / 132      
Total 660 Questions | Updated On: Apr 24, 2024
Question 1

Question ID: UK8298130
Consider below code of Test.java file:
package com.examtest.ocp;
 
class A {
    public String toString() {
        return null;
    }
}
 
public class Test {
    public static void main(String [] args) {
        String text = null;
        text = text + new A(); //Line n1
        System.out.println(text.length()); //Line n2
    }
}
What is the result?


Answer: A

Question 2

Question ID: UK8291525
Below is the code of TestSellable.java file:
package com.examtest.ocp;
 
interface Sellable {
    double getPrice();
}
 
public class TestSellable {
    private static void printPrice(Sellable sellable) {
        System.out.println(sellable.getPrice());
    }
 
    public static void main(String[] args) {
        /*INSERT*/
    }
}
Which of the following options can replace /*INSERT*/ such that there are no compilation errors?
Choose 3 options.


Answer: A,D

Question 3

Question ID: UK8297279
Consider below code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    public static void main(String [] args) {
        boolean flag1 = true;
        boolean flag2 = false;
        boolean flag3 = true;
        boolean flag4 = false;
        
        System.out.println(!flag1 == flag2 != flag3 == !flag4); //Line n1
        System.out.println(flag1 = flag2 != flag3 == !flag4); //Line n2
    }
}
What is the result?


Answer: A

Question 4

Question ID: UK8292454
Given code of Test.java file:
package com.examtest.ocp;
 
public class Test {
    private static void div(int i, int j) {
        try {
            System.out.println(i / j);
        } catch(ArithmeticException e) {
            throw (RuntimeException)e;
        }
    }
    
    public static void main(String[] args) {
        try {
            div(5, 0);
        } catch(ArithmeticException e) {
            System.out.println("AE");
        } catch(RuntimeException e) {
            System.out.println("RE");
        }
    }
}
What is the result?


Answer: C

Question 5

Question ID: UK8292860
Given code of Test.java file:
package com.examtest.ocp;
 
class Car {
    void speed(Byteval) { //Line n1
        System.out.println("DARK"); //Line n2
    } //Line n3
 
    void speed(byte... vals) {
        System.out.println("LIGHT");
    }
}
 
public class Test {
    public static void main(String[] args) {
        byte b = 10; //Line n4
        new Car().speed(b); //Line n5
    }
}
Which of the following needs to be done so that LIGHT is printed on to the console?


Answer: B

Page:    1 / 132      
Total 660 Questions | Updated On: Apr 24, 2024