Evaluation Du Cours Java Collections

48 Questions | Total Attempts: 924

SettingsSettingsSettings
Please wait...
Evaluation Du Cours Java Collections

Ce quiz a pour but D'évaluer  vos connaissances sur le cours "Collections JAVA".N'essayez pas de répondre a toutes les questions, ce Quiz a juste pour ambition d'évaluer votre niveau de maitrise du sujet ! 


Questions and Answers
  • 1. 
    // dans une méthode main // création du set Set<String> set = new HashSet<String>() ; // ajout d'élément System.out.println("J'ajoute un : " + set.add("un")) ; System.out.println("J'ajoute deux : " + set.add("deux")) ; // ajout d'un doublon : échec System.out.println("J'ajoute encore un : " + set.add("un")) ; // affichage de la taille du set System.out.println("Taille du set : " + set.size()) ;
  • 2. 
    What are we referring to when we mention java.util.Collections ?
    • A. 

      The interface from which lists, queues and sets extend

    • B. 

      The Collections framework

    • C. 

      A utilility class for use with collections

    • D. 

      We never mention this

  • 3. 
    What type of collection would we use if we wanted no duplicates?
    • A. 

      List

    • B. 

      Map

    • C. 

      Queue

    • D. 

      Set

  • 4. 
    What type of List is used with synchronized access?
    • A. 

      ArrayList

    • B. 

      Vector

    • C. 

      LinkedList

  • 5. 
    Question 4 :What type of collection does not extend the Collection<E> interface?
    • A. 

      List

    • B. 

      Map

    • C. 

      Queue

    • D. 

      Set

  • 6. 
    What type of Map is used with synchronized access?
    • A. 

      HashMap

    • B. 

      LinkedHashMap

    • C. 

      Hashtable

    • D. 

      Set

  • 7. 
    There are no direct implementation of the Collection interface?
    • A. 

      True

    • B. 

      False

  • 8. 
    What type of collection has always been type safe
    • A. 

      Array

    • B. 

      List

    • C. 

      Map

    • D. 

      Queue

    • E. 

      Set

  • 9. 
    What is the following code snippet an example of <T extends Number> ?
    • A. 

      bounded type

    • B. 

      Generic type

    • C. 

      Bounded wildcard type

    • D. 

      unbounded wildcard type

  • 10. 
    We can use generics with any type?
    • A. 

      True

    • B. 

      False

  • 11. 
    How are generics implemented?
    • A. 

      Asymmetry

    • B. 

      Erasure

    • C. 

      Reification

    • D. 

      Reflection

  • 12. 
    What is the following code snippet an example of  ?
    • A. 

      Bounded type

    • B. 

      generic type

    • C. 

      Bounded wildcard type

    • D. 

      Unbounded wildcard type

  • 13. 
    Is the following code snippet valid? ListaList = new ArrayList();
    • A. 

      YES

    • B. 

      NO

  • 14. 
     Is the following code snippet valid?public class SimpleGenericInterfaceImpl implements SimpleGenericInterface { ? 
    • A. 

      YES

    • B. 

      NO

  • 15. 
    Question 14:What is the following code snippet an example of <? extends Number> ?
    • A. 

      Bounded type

    • B. 

      Generic type

    • C. 

      Bounded wildcard type

    • D. 

      Unbounded wildcard type

  • 16. 
    What do sets care about
    • A. 

      Index

    • B. 

      Speed

    • C. 

      Uniqueness

  • 17. 
    What type of set would you use if you wanted a fast access ordered set but didn't care about sorting?
    • A. 

      HashSet

    • B. 

      LinkedHashSet

    • C. 

      TreeSet

  • 18. 
    Can we have a sorted and unordered set?
    • A. 

      YES

    • B. 

      NO

  • 19. 
    What type of set would you use if you wanted fast access and didn't care about ordering?
    • A. 

      HashSet

    • B. 

      LinkedHashSet

    • C. 

      TreeSet

  • 20. 
    What type of exception is raised when we run a program with objects that are not mutually comparable in a sorted set?
    • A. 

      NONE

    • B. 

      ClassCastException

    • C. 

      RuntimeException

    • D. 

      OutOfBoundsException

  • 21. 
    What type of set would you use if you wanted it sorted?
    • A. 

      HashSet

    • B. 

      LinkedHashSet

    • C. 

      TreeSet

  • 22. 
    Which type of list implements the Queue interface
    • A. 

      ArrayList

    • B. 

      LinkedList

    • C. 

      Vector

  • 23. 
    What type of collections are Lists?
    • A. 

      Ordered

    • B. 

      Sorted

    • C. 

      Unordered

  • 24. 
    Which List class is synchronized?
    • A. 

      ArrayList

    • B. 

      LinkedList

    • C. 

      Vector

  • 25. 
    What do Lists have in common?
    • A. 

      An index

    • B. 

      Element uniqueness

    • C. 

      Nothing

Back to Top Back to top