Working with types: Wrapper classes - Java test
1) The wrapper classes are part of the which package, that is imported by default into all Java programs?
A) java.lang
B) java.awt
C) java.io
D) java.util
View Answer / Hide Answer2) Which defines a method called nextElement that is used to get the next element in a data structure that contains multiple elements?
A) Bitset
B) Vector
C) Stack
D) Enumeration
View Answer / Hide Answer3) Which defines the methods by which you can enumerate (obtain one at a time) the elements in a collection of objects?
A) Stack class
B) Bitset class
C) Enumeration interface
D) None of the above
View Answer / Hide AnswerANSWER: C) Enumeration interface
4) Which specifies the following two methods ?
boolean hasMoreElements()
Object nextElement()
A) Enumeration
B) Bitset
C) Vector
D) Stack
View Answer / Hide Answer5) Which method Returns an enumeration of the values contained in the dictionary?
A) Enumeration elements()
B) Enumeration keys()
C) Enumeration propertyNames()
D) None of the above
View Answer / Hide AnswerANSWER: A) Enumeration elements()
6) Which method Returns an enumeration of the keys, This includes those keys found in the default property list, too?
A) Enumeration keys()
B) Enumeration elements()
C) Enumeration propertyNames()
D) Both A & B
View Answer / Hide AnswerANSWER: C) Enumeration propertyNames()
7) StringTokenizer implements the Enumeration interface?
A) True
B) False
View Answer / Hide Answer8) Which package does java provides in which it acts as an object -oriented wrapper around most common databases?
A) JDBC
B) ODBC
C) None of the above
View Answer / Hide Answer9) Filtered streams are simply wrappers around underlying input or output streams that transparently provide some extended level of functionality?
A) True
B) False
View Answer / Hide Answer10) Wrapper classes are not used to convert any data type into an object?
A) True
B) False
View Answer / Hide Answer11) Void it is not a wrapper class?
A) True
B) False
View Answer / Hide Answer12) The primitive data type values will be stored in ?
A) Heap Memory
B) Stack Memory
C) Both A & B
D) None of the above
View Answer / Hide Answer13) Which can be used as raw data for operations such as arithmetic, logical, etc?
A) Primitive data types
B) Wrapper classes
View Answer / Hide AnswerANSWER: A) Primitive data types
14) The following two statements illustrate the difference between a
int x = 25;
Integer y = new Integer(33);
A) Primitive data types
B) primitive data type and an object of a wrapper class
C) Wrapper class
D) None of the above
View Answer / Hide AnswerANSWER: B) primitive data type and an object of a wrapper class
15) Which allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics?
A) Enumeration
B) Iterator
C) None of the above
View Answer / Hide Answer16) Which method When implemented, it must return true while there are still more elements to extract, and false when all the elements have been enumerated?
A) Object nextElement( )
B) boolean hasMoreElements( )
C) Both A & B
D) None of the above
View Answer / Hide AnswerANSWER: B) boolean hasMoreElements( )