Recall & Review
beginner
What is a dictionary in computing?
A dictionary is a collection that stores data in pairs called key-value pairs. Each key is unique and is used to find its matching value, like looking up a word in a real dictionary to find its meaning.
Click to reveal answer
beginner
Explain the term 'key' in a dictionary.
A key is a unique identifier used to access a value in a dictionary. Think of it like a label on a box that tells you what's inside.
Click to reveal answer
beginner
How does a dictionary differ from a list?
A dictionary uses keys to find values, while a list uses numbered positions (indexes). It's like a phone book (dictionary) versus a numbered seating chart (list).
Click to reveal answer
intermediate
What happens if you try to use a key that does not exist in a dictionary?
You get an error or a special response saying the key is not found, similar to looking up a word that isn't in a dictionary.
Click to reveal answer
intermediate
Can keys in a dictionary be changed after creation?
No, keys are fixed and must be unique. However, the values they point to can be changed. It's like a label on a jar—you can't change the label, but you can change what's inside the jar.
Click to reveal answer
What does a dictionary store?
✗ Incorrect
A dictionary stores data as pairs of keys and values, where each key is unique.
Which of these is a valid key in a dictionary?
✗ Incorrect
Keys must be unique labels to identify values in a dictionary.
If you want to find a value in a dictionary, you use the:
✗ Incorrect
You use the key to look up the matching value in a dictionary.
What happens if you try to access a key that does not exist?
✗ Incorrect
Accessing a non-existent key usually causes an error or a 'not found' response.
Can dictionary keys be changed after they are created?
✗ Incorrect
Keys are fixed and cannot be changed once set; only values can be updated.
Describe what a dictionary is and how it stores data.
Think about how a phone book or a real dictionary works.
You got /5 concepts.
Explain the difference between a dictionary and a list.
Compare a phone book to a numbered seating chart.
You got /5 concepts.