Search Header Logo

java-Collections(part-II)-vlits

Authored by kolla vivek

Computers

1st Grade

Used 4+ times

java-Collections(part-II)-vlits
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

28 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Which of the following are true statements?

1.The Iterator interface declares only three methods: hasNext, next and remove. 2.The ListIterator interface extends both the List and Iterator interfaces.

3.The ListIterator interface provides forward and backward iteration capabilities.

4.The ListIterator interface provides the ability to modify the List during iteration.

5.The ListIterator interface provides the ability to determine its position in the List.

2, 3, 4 and 5

1, 3, 4 and 5

3, 4 and 5

1, 2 and 3

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which collection class allows you to associate its elements with key values, and allows you to retrieve objects in FIFO (first-in, first-out) sequence?

java.util.ArrayList

java.util.LinkedHashMap

java.util.HashMap

java.util.TreeMap

3.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

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() + " " );

}

one two three four

four three two one

four one three two

one two three four one

4.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Which statement is true for the class java.util.ArrayList?

The elements in the collection are ordered.

The collection is guaranteed to be immutable.

The elements in the collection are guaranteed to be unique.

The elements in the collection are accessed using a unique key.

5.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

Which collection class allows you to access its elements by associating a key with an element's value, and provides synchronization?

java.util.SortedMap

java.util.TreeMap

java.util.TreeSet

java.util.Hashtable

6.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

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());

}

42

Runtime Exception

Compile Error at line 2

Compile Error at line 5

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of these is not a interface in the Collections Framework?

Collection

Group

set

List

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?