Java - Online Test - Set - javasearch.buggybread.com


Share

Search Java Test Questions


 223 test questions in repository.




Java - Test Questions on 'set' - 10 questions found


If we add Enum constants to a sorted collection ( Treemap , TreeSet ), What will be the order in which they will be maintained ?Core Java
Sorted Collection wont maintain them in any order.
Insertion Order
Order in which constants are declared.
Natural Sorting Order.

  enum  collections  sorted collections  treemap  treeset  compareTo  comparable  java

In what order the elements of a HashSet are retrieved ?Core Java
Random Order
Insertion Order
Natural Sorting Order
Inverse Natural Sorting Order

  collections  set  hashset  java

What will be the output upon executing main method ?

public static void main(String[] args){
      Set set = new HashSet();
      set.add(1);
      set.add(2);
      set.add(3);
      System.out.println(set);
   }
Core Java
1,2,3
Order cannot be determined
Compilation error
3,2,1

  set  hashset  collections

Which of following stores its elements in natural Sorting Order ?Core Java
AbstractSet
HashSet
LinkedHashSet
TreeSet

  set  collections

Which of the following collection maintain its elements in Natural Sorted order ? Core Java
HashMap
TreeMap
LinkedHashMap
LinkedMap

  treemap  collections  java  sorted collections  map

POM stands for ... Maven
Project Object Model
Project Oriented Model
Prospective Object Model
Prospective Objective Model

  maven  pom

enums are intrinsically ..Core Java
private
public
static
final

  java  enum

Enums cannot be declared ..Core Java
private
public
static
final

  java  enum

Which method needs to be implemented if a class is implementing comparable interface ?Core Java
comp
compare
compareTo
compareEquals

  comparable  interfaces  compare  compareTo

What will be the output of exceuting main method ?

public static void main(String[] args){
      List list = new ArrayList();
      list.add(1);
      list.add(2);
      list.add(3);
      System.out.println(list);
   }
Core Java
1,2,3
Order cannot be determined
compilation error
3,2,1

  collections  list  arraylist







comments powered by Disqus