Java Collection maps

Java Collection maps

University

24 Qs

quiz-placeholder

Similar activities

IAS 101 - Week 11 and 12 - Cryptography

IAS 101 - Week 11 and 12 - Cryptography

University

20 Qs

Kuis 2 - PKS 1

Kuis 2 - PKS 1

University

20 Qs

1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni

1ºDAM/DAW - Entornos de Desarrollo - UD1-6 - Prof. C. Boni

University - Professional Development

20 Qs

8-期中总结

8-期中总结

University

20 Qs

basisdata1

basisdata1

University

20 Qs

Digital Electronics (Weekend Assignment - 3)

Digital Electronics (Weekend Assignment - 3)

University - Professional Development

20 Qs

Evaluasi Python Tuple

Evaluasi Python Tuple

University

20 Qs

Java Collection maps

Java Collection maps

Assessment

Quiz

Computers

University

Hard

Created by

A Vijay Kumar

Used 1+ times

FREE Resource

24 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which is faster and uses less memory?

ListEnumeration

Iterator

Enumeration

ListIterator

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which interface does java.util.Hashtable implement?

Java.util.Map

Java.util.List

Java.util.HashTable

Java.util.Collection

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Find the output

public class TreeMapTest {

public static void main(String args[]) {

Map<Integer, String> m = new TreeMap<Integer, String>();

m.put(11, "audi");

m.put(null, null);

m.put(11, "bmw");

m.put(null, "ferrari");

System.out.println(m.size());

System.out.println(m);

}

Nullpointer exception

compiler error

2

Null value

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class MyClass {

public static void main(String args[]) {

Map<String, String> hashMap = new HashMap<String, String>();

hashMap.put(new String("a"), "audi");

hashMap.put(new String("a"), "ferrari");

System.out.println(hashMap);

}

}

a=audi

a=audi

a=ferrari

a=ferrari

Run time Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is synchronized?

TreeMap

HashMap

Hashtable

All of the above

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you sort given HashMap on basis of values

Implement Comparator interface and override its compare method

It is not possible

Implement Comparator interface and override its compareTo method

Implement Comparator interface and override its comparable method

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statement is not True about Generics in java?

Generics are features of the Java programming language that allow programmers to write parameterized code.

With generics, the compiler can not detect violations at compile time, thus eliminating potential bugs.

Due to the demand of safer code, generics were added to the Java programming language.

generics allow you to write generic code

Stronger type checks at compile time

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?