Java Programming: Collections, Annotations, and Enums
Test your knowledge of Java Collections framework (HashMap, Hashtable, Vector, Iterator, ListIterator), Annotations, and Enumerations.
Questions
Which constant variable is not present in Long wrapper class?
- MAX_VALUE
- MIN_VALUE
- MIN_NORMAL
- SIZE
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.
- i. and iii. are true
- i. and iv. are true
- ii. and iii. are true
- ii. and iv. are true.
Which class from the following options contains decode(String str) method?
- Float
- Double
- Long
- Character
Which class contains MAX_RADIX constant variable from the following options?
- Float
- Double
- Long
- Character
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.
- i. and iii. are true
- i. and iv. are true
- ii. and iii. are true
- ii. and iv. are true
Find out the true statements.
i. HashMap is synchronized.
ii. HashMap is non-synchronized.
iii. Hashtable is non-synchronized.
iv. Hashtable is synchronized.
- i. and iii. are true.
- i. and iv. are true.
- ii. and iii. are true
- ii. and iv. are true.
What is the default size of Vector in Java?
- 0
- 1
- 5
- 10
What is the other name for annotation in Java?
- Annote
- Retention
- Metadata
- Annotate
Th enumeration constant position in the list of constants is known as
- ordinance value
- ordinal value
- position value
- positional value
Which interface is automatically extended by all annotation types?
- java.lang.annotation.Annotation
- java.lang.Annotation
- java.lang.Annotations
- java.lang.reflect.Annotation
The superclass for all enumerations in java known as
- java.lang.Enumeration
- java.lang.Enumerations
- java.lang.Enum
- java.lang.reflect.Enumeration
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.
- i. and iii. are true
- ii. and iii. are true
- i. and iv. are true
- ii. and iv. are true
What is the starting point for the ordinal values?
- Ordinal values begin at -1
- Ordinal values begin at 0
- Ordinal values begin at 1
- Ordinal values begin at 2
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.
- i. and iii. are true
- i. and iv. are true
- ii. and iii. are true
- ii. and iv. are true
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.
- i. and iii. are true.
- i. and iv. are true
- ii. and iii. are true.
- ii. and iv. are true.