Sets Review

Sets Review

Assessment

Flashcard

12th Grade - University

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

20 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Which of the following statement about Set is true? A TreeSet can have null values. Set allows duplicate values. Set allows null values but only single occurrence. Set extends the Java.util.collection interface.

Back

Set extends the Java.util.collection interface.

2.

FLASHCARD QUESTION

Front

Entries are not organized as key/value pairs. Duplicate entries are rejected. Which interface of the java.util package offers the specified behavior?

Back

Set

3.

FLASHCARD QUESTION

Front

Media Image

Back

[Computer, Network, Networks, Programming, Security]

4.

FLASHCARD QUESTION

Front

Media Image

Back

Line 11 : Genetates NullPointer Exception

5.

FLASHCARD QUESTION

Front

What is the output of the following code?
List listNames = new ArrayList();
listNames.add("Tom");
listNames.add("Mary");
listNames.add("Peter");
String name2 = (String) listNames.get(1);
System.out.println(name2);

Back

Mary

6.

FLASHCARD QUESTION

Front

When do we use sets in java program?

Back

You want to store elements distinctly without duplication, or unique elements.

7.

FLASHCARD QUESTION

Front

What will happen if an element already present in the Set is added again?

Back

A boolean value of false will be returned, and the value will not be added to the Set

Create a free account and access millions of resources

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?