Wrapper classes - Java (MCQ) questions and answers

1)   Which method when implemented must return true while there are still more elements to extract, and false when all the elements have been enumerated?

- Published on 19 Oct 15

a. Object nextElement( )
b. boolean hasMoreElements( )
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: boolean hasMoreElements( )

Explanation:
No explanation is available for this question!


2)   Which defines a method called nextElement that is used to get the next element in a data structure that contains multiple elements?
- Published on 20 Jul 15

a. Bitset
b. Vector
c. Stack
d. Enumeration
Answer  Explanation 

ANSWER: Enumeration

Explanation:
No explanation is available for this question!


3)   Consider the following two statements

int x = 25;
Integer y = new Integer(33);
What is the difference between these two statements?

- Published on 17 Jul 15

a. Primitive data types
b. primitive data type and an object of a wrapper class
c. Wrapper class
d. None of the above
Answer  Explanation 

ANSWER: primitive data type and an object of a wrapper class

Explanation:
No explanation is available for this question!


4)   Which allows the caller to remove elements from the underlying collection during the iteration with well-defined semantics?
- Published on 17 Jul 15

a. Enumeration
b. Iterator
c. None of the above
Answer  Explanation 

ANSWER: Iterator

Explanation:
No explanation is available for this question!


5)   Filtered streams are simply wrappers around underlying input or output streams that transparently provide some extended level of functionality.
- Published on 17 Jul 15

a. True
b. False
Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


6)   Where does the primitive data type values be stored?
- Published on 16 Jul 15

a. Heap Memory
b. Stack Memory
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Stack Memory

Explanation:
No explanation is available for this question!


7)   Which method returns an enumeration of the values contained in the dictionary?
- Published on 15 Jul 15

a. Enumeration elements()
b. Enumeration keys()
c. Enumeration propertyNames()
d. None of the above
Answer  Explanation 

ANSWER: Enumeration elements()

Explanation:
No explanation is available for this question!


8)   What package is a part of the wrapper class which is imported by default into all Java programs?
- Published on 15 Jul 15

a. java.lang
b. java.awt
c. java.io
d. java.util
Answer  Explanation 

ANSWER: java.lang

Explanation:
No explanation is available for this question!


9)   Wrapper classes are not used to convert any data type into an object.
- Published on 15 Jul 15

a. True
b. False
Answer  Explanation 

ANSWER: False

Explanation:
No explanation is available for this question!


10)   What method Returns an enumeration of the keys which includes those keys found in the default property list?
- Published on 13 Jul 15

a. Enumeration keys()
b. Enumeration elements()
c. Enumeration propertyNames()
d. Both A & B
Answer  Explanation 

ANSWER: Enumeration propertyNames()

Explanation:
No explanation is available for this question!


1 2