Xəbərlər

Oracle tərəfindən yayınlanmış Java sertifikat imtahanı sualı nümunələri

java exam questions
Written by Mushfiq Mammadov

Oracle öz rəsmi blogunda bir sıra Java sertifikat imtahanlarına dair sual nümunələri paylaşıb. Həmin imtahanların siyahısı aşağıda qeyd olunub:

Java SE 7 Programmer I | 1Z0-803

1. Given:

class Calculator {
    int num = 100;
    public void calc(int num) {
        this.num = num * 10;
    }
    public void printNum() {
        System.out.println(num);
    }
    public static void main(String[] args) {
        Calculator obj = new Calculator();
        obj.calc(2);
        obj.printNum();
    }
}

What is the result?
A) 20
B) 100
C) 1000
D) 2

..daha çox sual və cavab..

Java SE 7 Programmer I | 1Z0-804

1. Given:

class MySort implements Comparator<Integer> {
    public int compare(Integer x, Integer y) {
        return y.compareTo(x);
    }
}

And the code fragment:

    Integer[] primes = {2, 7, 5, 3};
    MySort ms = new MySort();
    Arrays.sort(primes, ms);
    for (Integer p2 : primes) {
        System.out.print(p2 + " ");
    }

What is the result?
A) 2 3 5 7
B) 2 7 5 3
C) 7 5 3 2
D) Compilation fails.

..daha çox sual və cavab..

Upgrade to Java SE 7 Programmer | 1Z0-805

1. Given:

import java.io.*;
class MyResource1 implements AutoCloseable {
    public void close() throws IOException {  // A1
        System.out.print("1 "); }
}
class MyResource2 implements Closeable {
    public void close() throws Exception {    // A2
        System.out.print("2 "); }
}
public class Triangle {
    public static void main(String[] args) throws IOException {
        try (MyResource1 r1 = new MyResource1();        // B1
            MyResource2 r2 = new MyResource2();) {      // B2
            System.out.print("t ");
        } finally {
            System.out.print("f ");
        }
    }
}

What is the result?
A) t 2 1 f
B) t 1 2 f
C) Compilation fails due to errors on lines A1 and B1.
D) Compilation fails due to errors on lines A2 and B2.

..daha çox sual və cavab..

Java SE 8 Programmer I | 1Z0-808

1. Given:

import java.util.ArrayList;
import java.util.List;

public class JavaSETest {
    public static void main(String[] args) {
        List elements = new ArrayList<>();
        elements.add(10);
        int firstElmnt = elements.get(1);
        System.out.println(firstElmnt);
    }
}

What is the result?
A) null
B) 10
C) 0
D) An IndexOutOfBoundsException is thrown at runtime.

..daha çox sual və cavab..

Java SE 8 Programmer II | 1Z0-809

1. Given:

public abstract class Customer {
    private String name;
    public Customer(String name) {
        this.name = name;
    }
    public String getName() { return name; }
    public abstract void buy();
}

Which two statements are true about Customer?
A) The Customer class cannot be extended.
B) The Customer class cannot be instantiated.
C) Subclasses of Customer cannot override getName() method.
D) Concrete subclasses of Customer must use a default constructor.
E) Concrete subclasses of Customer must implement the buy() method.
F) Subclasses of Customer must implement the buy() method.

..daha çox sual və cavab..

Upgrade Java SE 7 to Java SE 8 OCP Programmer | 1Z0-810

1. Given the code fragment:

public class App {
    void calcBill() {
        // Line n1 
        new Invoice().print();
    }
}

Which code fragment can be inserted at Line n1 to enable the class compile?

A)    private class Invoice {
void print() { System.out.println("Invoice Printed"); }
}

B)    public class Invoice {
void print() {System.out.println("Invoice Printed");}
}

C)    class Invoice {
void print() {System.out.println("Invoice Printed");}
}

D)   protected class Invoice {
void print() {System.out.println("Invoice Printed");}
}

..daha çox sual və cavab..

Upgrade to Java SE 8 OCP ( Java SE 6 and all prior versions) | 1Z0-813

1. Which code fragment correctly assign a numeric literal?

A) byte b1 = b1011;
B) byte b2 = 1011b;
C) byte b3 = 0b1001;
D) byte b4 = 0xb001;

..daha çox sual və cavab..

Java SE 5 and 6, Certified Associate | 1Z0-850

1) You are creating a space flight simulation for a start-up aeronautics company. This simulation program must calculate the orbital mechanics and display the flight path on a graphics screen.

What type of data is most appropriate for calculating the orbital mechanics equations?
a) pixel
b) boolean
c) integer
d) floating point (*)
e) enumerated type

..daha çox sual və cavab..

Java SE 6 Programmer Certified Professional | 1Z0-851

1) Given:

class SuperFoo {
    SuperFoo doStuff(int x) {
        return new SuperFoo();
    }
}

class Foo extends SuperFoo {
  // insert code here
}

And four declarations:
I.   Foo doStuff(int x) { return new Foo(); }
II.  Foo doStuff(int x) { return new SuperFoo(); }
III. SuperFoo doStuff(int x) { return new Foo(); }
IV.  SuperFoo doStuff(int y) { return new SuperFoo(); }

Which, inserted independently at line 8, will compile?
a) Only I.
b) Only IV.
c) Only I and III.
d) Only I, II, and III.
e) Only I, III, and IV. (*)
f) All four declarations will compile.

..daha çox sual və cavab..

 

Mənbə: Oracle Blog

About the author

Mushfiq Mammadov

Leave a Comment


The reCAPTCHA verification period has expired. Please reload the page.

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.