
hashmap

Quiz
•
Information Technology (IT)
•
University
•
Hard
Amina Amina
Used 4+ times
FREE Resource
14 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a HashMap?
A data structure for storing ordered key-value pairs
A data structure for storing unordered key-value pairs that uses a hash function for fast access.
A data structure that uses trees to store values
A data structure for storing homogeneous elements.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you create an empty HashMap?
hash_map = {}
hash_map = []
hash_map = set()
hash_map = dict()
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you insert a key-value pair into a HashMap?
hash_map.add("apple", 5)
hash_map.put("apple", 5)
hash_map["apple"] = 5
hash_map.insert("apple", 5)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you check if a key exists in a HashMap?
key.exists("apple")
hash_map.contains("apple")
hash_map.has_key("apple")
"apple" in hash_map
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if you try to retrieve a value for a non-existing key in a HashMap?
A KeyError will be raised
It returns None
It returns a default value if specified
It returns an empty value (e.g., "" or 0).
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you remove a key-value pair from a HashMap?
hash_map.remove("apple")
hash_map.del("apple")
- del hash_map["apple"]
hash_map.delete("apple")
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you update the value for an existing key in a HashMap?
hash_map["apple"] = new_value
hash_map.update("apple", new_value)
hash_map.set("apple", new_value)
hash_map.insert("apple", new_value)
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Mastering Python Control Flow

Quiz
•
University
14 questions
ORM - Django

Quiz
•
University
10 questions
Fundamentos de Programación en Python

Quiz
•
6th Grade - University
18 questions
JAVA-Day4

Quiz
•
University
15 questions
Python for loop/lists

Quiz
•
9th Grade - University
15 questions
Power BI Quiz (Beginner Level)

Quiz
•
University
10 questions
Python_Quiz_1

Quiz
•
University
15 questions
Quiz sobre el ornitorrinco y la programación

Quiz
•
8th Grade - University
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade