MOBI BOOT CAMP CORP. logoLearning Buddy
  • SIGN IN
  • Introduction
  • Warm up
  • 1: Collections
    • HashMap and HashSet
    • Stacks, Queues, and Priority Queues
    • Primitives and Objects in Memory
    • Quiz
    • Exercise
    • Collections and OOP Slides
  • 2: More OOP
  • 3: Exceptions, Threads & File
  • 3: Other Concepts
  • 4: Graphical User Interface (GUI)
<question>
    <p>You are creating a contacts list to save the name of your contacts and their phone numbers. You want to retrieve a list of phone numbers by searching on the name. Which structure would you use?
    </p>
    <answer>HashSet<String></answer>
    <answer>ArrayList<String></answer>
    <answer correct>HashMap<String, List></answer>
    <explanation>HashMap<String,List> is the correct structure as it allows you to save the name of the contact with more than one phone number per contact saved as an ArrayList</explanation>
</question>

<question>
        <p> You are saving the SSN numbers of people working in a company. You do not want any duplicate entries. Which structure would you use?
        </p>
        <answer correct>HashSet<String></answer>
        <answer>ArrayList<String></answer>
        <answer>HashMap<String, List></answer>
        <explanation> In a set you cannot have duplicates and since it is only SSN number being saved you can use a HashSet</explanation>
</question>
<question>
        <p> An ArrayList automatically increases its size when more elements are added to it. True or False
        </p>
        <answer correct>True<String></answer>
        <answer>False<String></answer>
</question>
<question>
            <p> Can you sort the names of people stored in an ArrayList in ascending or descending order? If so what is the name of the method? Look into the ArrayList documentation to answer this question.
            </p>
            <answer correct>Yes, using sort method<String></answer>
            <answer>No, sort method is not there for ArrayList</answer>
 </question>
Privacy Policy | Terms & Conditions