Browse all questions..

Overriding and Overloading is for ?

  1. Methods and variables

  2. class

  3. variables

  4. Methods

Answer: 4

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

Answer: 2
Explanation:

All the words in option B are among the 49 Java keywords. Although goto reserved as a keyword in Java, goto is not used and has no function.Option A is wrong because the keyword for the primitive int starts with a lowercase i.Option C is wrong because "vi

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};

Answer: 4

Which is a reserved word in the Java programming language?

  1. method

  2. native

  3. subclasses

  4. reference

Answer: 2

Which is a valid keyword in java?

  1. interface

  2. string

  3. Float

  4. unsigned

Answer: 1

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;

Answer: 2

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);

Answer: 1

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();

Answer: 3
Explanation:

A boolean can only be assigned the literal true or false.

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';

Answer: 1

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

Answer: 4