GoConqr has a new look! Let us know what you think.

Quiz

OCAJP7

. 48 questions

Take the quiz

Questions in this quiz (48)

  1. 1Which of the following is illegal:
    1. Aint i = 32;
    2. Bfloat f = 45.0;
    3. Cdouble d = 45.0;
  2. 2public class Test {
    static int age;
    public static void main (String args []) {
    age = age + 1;
    System.out.println("The age is " + age);
    }
    }
    1. ACompiles and runs with no output
    2. BCompiles and runs printing out The age is 1
    3. CCompiles but generates a runtime error
    4. DDoes not compile
    5. ECompiles but generates a compile time error
  3. 3public static void main(String[] args) {
    int age;
    System.out.println(age+1);
    }
    1. ACompiles and runs with no output
    2. BCompiles and runs printing out The age is 1
    3. CCompiles but generates a runtime error
    4. DDoes not compile
    5. ECompiles but generates a compile time error
  4. 4 Which of the following return true?
    1. A"john" == "john"
    2. B"john".equals("john")
    3. C"john" = "john"
    4. D"john".equals(new Button("john"))
  5. 5 Which of the following is correct:
    1. AString temp [] = new String {"j", "a", "z"};
    2. BString temp [] = {"a", "b", "c"};
    3. CString temp = {"a", "b", "c"};
    4. DString temp [] = new String [] {"j" "a" "z"};
    5. EString temp [] = new String[3] {"j" "a" "z"};
  6. 6Compiler adds default constructor to class which hasn't got constructor with empty argument list. Is it true?
    1. ATrue
    2. BFalse
  7. 7Which of the following are acceptable to the Java 7 compiler?
    1. Aif (2 == 3) System.out.println("Ok");
    2. Bif (false) System.out.println("Ok");
    3. Cif (true) System.out.println("Ok");
    4. Dboolean b = false; if (b = true) System.out.println("Ok");
  8. 8Assuming a method contains code which may raise an Exception (but not a Runtime Exception), what is the correct way for a method to indicate that it expects the caller to handle that exception:
    1. Athrow Exception
    2. Bthrows Exception
    3. CDon't need to specify anything
  9. 9Czy w jednym konstruktorze można wywołać inny konstruktor z tej samej klasy i konstruktor z klasy bazowej jednocześnie?
    1. ATrue
    2. BFalse
  10. 10Which variables can an inner class access from the class which encapsulates it?
    1. AAll static variables
    2. BAll final variables
    3. CAll instance variables
    4. DOnly final instance variables
    5. EOnly final static variables

Information

Description
Nietrywialne pytania napotkane podczas nauki do OCAJP7. Może służyć do przypominania sobie mechanizmów języka.
Author
. .
Language
English
Views
135
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?