6. 

What will be the output of the program?

import java.util.*; 
class H 
{
    public static void main (String[] args) 
    { 
        Object x = new Vector().elements(); 
        System.out.print((x instanceof Enumeration)+","); 
        System.out.print((x instanceof Iterator)+","); 
        System.out.print(x instanceof ListIterator); 
    } 
}

A. Prints: false,false,false
B. Prints: false,false,true
C. Prints: false,true,false
D. Prints: true,false,false

7. 

What will be the output of the program?

TreeSet map = new TreeSet();
map.add("one");
map.add("two");
map.add("three");
map.add("four");
map.add("one");
Iterator it = map.iterator();
while (it.hasNext() ) 
{
    System.out.print( it.next() + " " );
}

A. one two three four
B. four three two one
C. four one three two
D. one two three four one

8. 

What will be the output of the program?

public static void main(String[] args) 
{
    Object obj = new Object() 
    {
        public int hashCode() 
        {
            return 42;
        }
    }; 
    System.out.println(obj.hashCode()); 
}

A. 42
B. Runtime Exception
C. Compile Error at line 2
D. Compile Error at line 5