OCPJP

OCPJP,

10 Questions

Questions

Question 1 Multiple Choice (Single Answer)

Overriding and Overloading is for ?

  1. Methods and variables
  2. class
  3. variables
  4. Methods
Question 2 Multiple Choice (Single Answer)

Which one of these lists contains only Java programming language keywords?

  1. class, if, void, long, Int, continue
  2. goto, instanceof, native, finally, default, throws
  3. try, virtual, throw, final, volatile, transient
  4. strictfp, constant, super, implements, do
Question 3 Multiple Choice (Single Answer)

Which will legally declare, construct, and initialize an array?

  1. int [] myList = {"1", "2", "3"};
  2. int [] myList = (5, 8, 2);
  3. int myList [] [] = {4,9,7,0};
  4. int myList [] = {4, 3, 7};
Question 4 Multiple Choice (Single Answer)

Which is a reserved word in the Java programming language?

  1. method
  2. native
  3. subclasses
  4. reference
Question 5 Multiple Choice (Single Answer)

Which is a valid keyword in java?

  1. interface
  2. string
  3. Float
  4. unsigned
Question 6 Multiple Choice (Single Answer)

Which one of the following will declare an array and initialize it with five numbers?

  1. Array a = new Array(5);
  2. int [] a = {23,22,21,20,19};
  3. int a [] = new int[5];
  4. int [5] array;
Question 7 Multiple Choice (Single Answer)

Which is the valid declarations within an interface definition?

  1. public double methoda();
  2. public final double methoda();
  3. static void methoda(double d1);
  4. protected void methoda(double d1);
Question 8 Multiple Choice (Single Answer)

Which one is a valid declaration of a boolean?

  1. boolean b1 = 0;
  2. boolean b2 = 'false';
  3. boolean b3 = false;
  4. boolean b4 = Boolean.false();
Question 9 Multiple Choice (Single Answer)

Which is a valid declarations of a String?

  1. String s1 = null;
  2. String s2 = 'null';
  3. String s3 = (String) 'abc';
  4. String s4 = (String) '\ufeed';
Question 10 Multiple Choice (Single Answer)

What is the numerical range of a char?

  1. -128 to 127
  2. -(215) to (215) - 1
  3. 0 to 32767
  4. 0 to 65535