Computer Basics - 2

 Description: Computer Basics Mix Test - 2 Number of Questions: 15 Created by: Tanya Dwivedi Tags: Computer Basics Mix Test - 2 Computer Basics
Attempted 0/15 Correct 0 Score 0

Which constant variable is not present in Long wrapper class?

1. MAX_VALUE

2. MIN_VALUE

3. MIN_NORMAL

4. SIZE

Correct Option: C
Explanation:

The answer is correct. MIN_NORMAL is the constant variable that is not present in Long wrapper class. Instead it is present in Float and Double classes, which will return the minimum positive normal value.

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.

Correct Option: C
Explanation:

This answer is correct. Iterator interface is used to obtain elements from the collection in forward direction only. ListIterator is used to obtain elements from the collection in bi-directional direction only.

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

1. Float

2. Double

3. Long

4. Character

Correct Option: C
Explanation:

This answer is correct. Long, Byte, Short, Integer classes do have the decode method which will return the respective Class object like Long, Byte, Short, Integer based on the call from the respective classes. Also,  the object that is returned contains the value specified by the string.

Which class contains MAX_RADIX constant variable from the following options?

1. Float

2. Double

3. Long

4. Character

Correct Option: D
Explanation:

This answer is correct. MAX_RADIX is related to the character class since it gets the largest radix of the character sequence.

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

Correct Option: B
Explanation:

This answer is correct. HashMap allows null in the key value pairs. It can have null in the key as well as values. Hashtable does not allow null in the key value pairs. It will not have any null in the key or value pairs.

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.

Correct Option: D
Explanation:

This answer is correct. HashMap is not thread-safe or synchronized. In other words, HashMap is non-synchronized. So, the key value pair is not thread-safe. Hashtable is thread-safe or synchronized.The key value pair will not be affected by different threads.

What is the default size of Vector in Java?

1. 0

2. 1

3. 5

4. 10

Correct Option: D
Explanation:

This answer is correct. Vector is a part of Collections family. Unlike other classes, the default size of Vector is 10.

What is the other name for annotation in Java?

1. Annote

2. Retention

4. Annotate

Correct Option: C
Explanation:

This answer is correct. The other name for annotation is metadata. But the term annotation is the most commonly used word.

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

1. ordinance value

2. ordinal value

3. position value

4. positional value

Correct Option: B
Explanation:

This answer is correct. The enumeration constant's position in the list of constants is called ordinal value. This gives the position of constants from the list of enumeration constants.

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

Correct Option: A
Explanation:

This answer is correct. All annotation types extend the Annotation interface which is from java.lang.annotation package. Annotation is a super-interface of all annotations.

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

Correct Option: C
Explanation:

This answer is correct. The class java.lang. Enum exists in java.lang package. Also, all enumerations inherit java.lang.Enum superclass. This class defines several methods that are available for use by all enumerations.

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

Correct Option: B
Explanation:

This answer is correct. Enum do not need to be instantiated using the new keyword. Enum can have constructors and it will be called whenever the enum object is referred.

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

Correct Option: B
Explanation:

This answer is correct. Ordinal values in the list of enumeration always begins from zero.

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

Correct Option: D
Explanation:

This answer is correct. An enumeration cannot inherit any other class. The enum cannot be extended, and no other class can inherit enum class. In other words, enum can never be a super class.

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.

Correct Option: B
Explanation:

This answer is correct. Iterator is used to obtain the elements from the collection in forward direction only. Also, it has the capability to remove the elements from the collection. List Iterator is used to obtain the elements from the collection in forward direction only. Also, it has the capability to modify the elements in the collection.

- Hide questions