Quiz
Java SCJP Collection 1
Crie uma conta grátis para terminar este quiz
Salve seu progresso e veja sua nota final.
Já tem uma conta? Inicie sessão
Perguntas do quiz (15)
1Which collection class(es) allows you to grow or shrink its size and provides indexed access to
its elements, but whose methods are not synchronized? (Choose all that apply.)- Ajava.util.HashSet
- Bjava.util.List
- Cjava.util.ArrayList
- Djava.util.Vector
- Ejava.util.PriorityQueue
- Fjava.util.LinkedHashSet
2Which one of the following is true about natual order and insertion order ?
- Ainsertion order means that the order in which the items are inserted into the collection
- Binsertion order is determined by seeing if the element is inserted into the collection by using the insert() or add().
- CNatural order is different from insertion order is that the order incase of natural is determined by observing the data in the object in context
- DNatural order is not same as insertion order
3Wchich implementation of Set would you choose if the you want the iterator of set would geive you objects in the order it were inserted ?
- ALinkedHashSet
- BTreeSet
- CHashSet
4What is the data structure that a Set uses to store its elements ?
- Aarray
- Bobject
- CMap
- DArrayList
5Set allows at most one null element ?
- ATrue
- BFalse
6If you were to use a List implementation,but not sure which one to, bacause the requirement is not yet clear. In this case which List implementation will you use ?
- AArrayList
- BVector
- CLinkedList
7If you were to store objects into an implementation of List which happens only once in the entire lifecycle of the product,but reading these objects inside the List implementation is quite high,then which one would you use ?
- AVector
- BLinkedList
- CArrayList
8Which of the following implementation will you use if you were to insert elements at any position in the collection ?
- AArrayList
- BLinkedList
- CVector
9The EMPTY_LIST field and teh emptyList() method does return an empty immutable List .(The same also applies to
EMPTY_SET,EMPTY_MAP and corresponding methods emptySet,emptyMap). Which of the following is/are true ?- AThere is no difference between the field and emptyList() ways to fetch an empty immutable list
- BThe field gives you a non type-safe empty immutable object where are the method return type-safe empty immutable object of collection
- CThe method to get the empty immutable collections are not static, so we need to create an object of Collections class in-order to call these methods,so fields like EMPTY_XXX are better choice if one doesn't want to create object of Collections.
- DThe emptyXxx() methods actually returns the EMPTY_XXX fields.
10Which of the following is true about creating an empty List, but immutable ?
- Afinal List immutableEmptyList=new ArrayList();
- BList immutableEmptyList=Collections.unmodifiableList(new List());
- CList immutableEmptyList=Collections.EMPTY_LIST
- DList immutableEmptyList=Collections.unmodifiableList(new ArrayList());
11How do you get immutable object of a collection ? For example if you were to write an API which return a List or a Set or a Map when a method is called, but you also want that you don't want the client of your API to add or delete any object in the returned collection ?
- AUse Collections.immutableCollection() method.
- BUse the Collections.unmodifiableXxxx() method with the collection as an argument,which returns an immutable object of specific type.
12Enumeration is an interface helps to iterate collection,but it can't remove any element the collection it is iterating
- ATrue
- BFalse
13which of the following are false about Collections and Collection ?
- ACollections is a utility class
- BCollection is an interface to Set and List
- CCollections is a special type of collection which holds Set of collections
- DBoth Collections and Collection entity belongs to java.util package.
14Which of the following Collection are synchronized by nature ?
- AVector
- BSortedSet
- CHashtable
- DHashMap
15Which of the following are true about ListIterator and Iterator ?
- AIterator can traverse in forward direction only
- BListIterator can traverse lists in both direction
- CIterator can do operations like modifying the items it holds.
- DListIterator extends the Iterator interface
- EIterator can remove the elements
Informações
- Descrição
- Java SCJP Collection 1
- Autor
- sonalihande81
- Idioma
- English
- Visualizações
- 124
- Etiquetas
- Avaliação
- Ainda sem avaliações Avalie este quiz