(Quiz) Sun Certified Java Program (SCJP)- Collection
Quiz: Sun Certified Java Program (SCJP)- Collection
Questions 1 Which most closely matches a description of a Java Map?
(a) A vector of arrays for a 2D geographic representation.
(b) A class for containing unique array elements.
(c) A class for containing unique vector elements.
(d) An interface that ensures that implementing classes cannot contain duplicate keys.
Answers:1 (d)
Questions 2 How does the set collection deal with duplicate elements?
(a) An exception is thrown if you attempt to add an element with a duplicate value.
(b) The add method returns false if you attempt to add an element with a duplicate value.
(c) A set may contain elements that return duplicate values from a call to the equals method.
(d) Duplicate values will cause an error at compile time.
Answers:2 (b)
Questions 3 Which of the following most closely describes a bitset collection?
(a) A class that contains groups of unique sequences of bits.
(b) A method for flipping individual bits in instance of a primitive type.
(c) An array of boolean primitives that indicate zeros or ones.
(d) A collection for storing bits as on-off information, like a vector of bits.
Answers: 3 (d)
This is the description given to a bitset in Bruce Eckels "Thinking in Java" book. The reference to unique sequence of bits was an attempt to mislead because of the use of the word Set in the name bitset. Normally something called a set implies uniqueness of the members, but not in this context.
Courtesy:- http://r4r.co.in/
- guru's blog
- Login to post comments
