Search Header Logo

Unit 4 Maps - Java - CSIII

Authored by Antonio Leon

Computers

11th Grade

11 Questions

Used 2+ times

Unit 4 Maps - Java - CSIII
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a map in java?

A map in Java is a data structure which stores data in key-value pairs
A map in Java is a function that applies to all elements in a list
A map in Java is a method for converting strings to integers
A map in Java is a type of loop structure

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not a type of Map in Java?

HashMap

LinkedHashMap

TreeMap

MapList

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will happen if you try to insert the duplicate key into a Java Map?

It will throw an exception

It will replace the old value with the new one

It will ignore the new value

Both key and value will be duplicated

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the put() function do in a Java Map?

It adds a new key-value pair to the map

It removes a key-value pair from the map

It checks if a key exists in the map

It clears all entries from the map

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method is used to check if a Map contains a specific key?

containsKey()

hasKey()

isKey()

keyExists()

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default initial capacity of a HashMap in Java?

10

16

32

64

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method is used to retrieve a value from a Map using a key?

getValue()

fetchValue()

get()

retrieveValue()

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?