Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You can sort an array using the sort method in the Arrays class. true false You

ID: 3582897 • Letter: Y

Question

You can sort an array using the sort method in the Arrays class. true false You can use index to traverse elements in an ArrayList. true false the elements in an ArrayList can be traversed using List Iterator or using index. false true List Iterator is a subclass of Iterator. false true The Map is the base interface for. ArrayList LinkedList HashMap LinkedHashMap TreeMap Analyze the following code. import java.util.*; public class Test {public static %roid main (String [] args) throws Exception {TreeSet set - new TreeSet(); set.add

Explanation / Answer

ans 50)

import java.awt.event.ActionEvent;

import com.sun.org.apache.bcel.internal.classfile.InnerClass;

import java.lang.reflect.Array;
import java.util.*;
public class outermain {
   public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
  
       int array[]={21,3,4};
      
       Arrays.sort(array);
       for(int i=0;i<array.length;i++)
           System.out.println(array[i]);
      
           }
  
}
ans==true;
output:
3
4
21
51)
import java.awt.event.ActionEvent;
import com.sun.org.apache.bcel.internal.classfile.InnerClass;
import java.lang.reflect.Array;
import java.util.*;
public class outermain {
   public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
   List<Integer>ls=new ArrayList<Integer>();
       ls.add(22);
       ls.add(11);
      
       for(int i=0;i<ls.size();i++)
           System.out.println(ls.get(i));
      
           }
  
}
ans)true
output:
22
11

54 ans)Hashmap
LinkedHashMap
TreeMap
55 )   Scanner sc=new Scanner(System.in);
   TreeSet<String>ls=new TreeSet<String>();
       ls.add("red");
       ls.add("yellow");
       ls.add("greeen");
       ls.add("blue");
       SortedSet temp=ls.headSet("purple");
      
           System.out.println(temp.first());
ans)blue;


import java.awt.event.ActionEvent;
import com.sun.org.apache.bcel.internal.classfile.InnerClass;
import java.lang.reflect.Array;
import java.util.*;
public class outermain {
   public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
   LinkedHashSet<String>ls=new LinkedHashSet<String>();
       ls.add("new york");
       LinkedHashSet<String>ls2=new LinkedHashSet<String>(ls.clone());
       ls2.add("atlanta");
       ls2.add("dullos");
      
           System.out.println(ls2);
      
           }
  
}
output:
[newyork,atlantic,dallos]

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote