Java Programming: Collections, Annotations, and Enums

Test your knowledge of Java Collections framework (HashMap, Hashtable, Vector, Iterator, ListIterator), Annotations, and Enumerations.

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which constant variable is not present in Long wrapper class?

  1. MAX_VALUE
  2. MIN_VALUE
  3. MIN_NORMAL
  4. SIZE
Question 2 Multiple Choice (Single Answer)

Find out the true statements.

i. Iterator is used to obtain the element in the bi-directional direction.
ii. Iterator is used to obtain the elements in the forward direction only.
iii. List Iterator is used to obtain the element in the bi-directional direction.
iv. List Iterator is used to obtain the element in the forward direction only.

  1. i. and iii. are true
  2. i. and iv. are true
  3. ii. and iii. are true
  4. ii. and iv. are true.
Question 3 Multiple Choice (Single Answer)

Which class from the following options contains decode(String str) method?

  1. Float
  2. Double
  3. Long
  4. Character
Question 4 Multiple Choice (Single Answer)

Which class contains MAX_RADIX constant variable from the following options?

  1. Float
  2. Double
  3. Long
  4. Character
Question 5 Multiple Choice (Single Answer)

Find out the true statements.

i. HashMap allows null values in a key value pair.
ii. HashMap does not allow null values in a key value pair.
iii. Hashtable allows null values in a key value pair.
iv. Hashtable does not allow null values in a key value pair.

  1. i. and iii. are true
  2. i. and iv. are true
  3. ii. and iii. are true
  4. ii. and iv. are true
Question 6 Multiple Choice (Single Answer)

Find out the true statements.

i. HashMap is synchronized.
ii. HashMap is non-synchronized.
iii. Hashtable is non-synchronized.
iv. Hashtable is synchronized.

  1. i. and iii. are true.
  2. i. and iv. are true.
  3. ii. and iii. are true
  4. ii. and iv. are true.
Question 7 Multiple Choice (Single Answer)

What is the default size of Vector in Java?

  1. 0
  2. 1
  3. 5
  4. 10
Question 8 Multiple Choice (Single Answer)

What is the other name for annotation in Java?

  1. Annote
  2. Retention
  3. Metadata
  4. Annotate
Question 9 Multiple Choice (Single Answer)

Th enumeration constant position in the list of constants is known as

  1. ordinance value
  2. ordinal value
  3. position value
  4. positional value
Question 10 Multiple Choice (Single Answer)

Which interface is automatically extended by all annotation types?

  1. java.lang.annotation.Annotation
  2. java.lang.Annotation
  3. java.lang.Annotations
  4. java.lang.reflect.Annotation
Question 11 Multiple Choice (Single Answer)

The superclass for all enumerations in java known as

  1. java.lang.Enumeration
  2. java.lang.Enumerations
  3. java.lang.Enum
  4. java.lang.reflect.Enumeration
Question 12 Multiple Choice (Single Answer)

Find out the true statement.

i. Enum should be instantiated using new keyword.
ii. Enum should not be instantiated using new keyword.
iii. Enum can have constructors.
iv. Enum do not have any constructors.

  1. i. and iii. are true
  2. ii. and iii. are true
  3. i. and iv. are true
  4. ii. and iv. are true
Question 13 Multiple Choice (Single Answer)

What is the starting point for the ordinal values?

  1. Ordinal values begin at -1
  2. Ordinal values begin at 0
  3. Ordinal values begin at 1
  4. Ordinal values begin at 2
Question 14 Multiple Choice (Single Answer)

Which is true from the following statements?

i. An enumeration can inherit another class.
ii. An enumeration cannot inherit another class.
iii.An enum can be a superclass.
iv. An enum can never be a superclass.

  1. i. and iii. are true
  2. i. and iv. are true
  3. ii. and iii. are true
  4. ii. and iv. are true
Question 15 Multiple Choice (Single Answer)

Find out the true statements.

i. Iterator is used to obtain and remove the elements from the collection.
ii. Iterator is used to obtain and modify the elements in the collection.
iii. List Iterator is used to obtain and remove the elements from the collection.
iv. List Iterator is used to obtain and modify the elements in the collection.

  1. i. and iii. are true.
  2. i. and iv. are true
  3. ii. and iii. are true.
  4. ii. and iv. are true.