0
0
Intro to Computingfundamentals~5 mins

Dictionaries and key-value pairs in Intro to Computing - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
APairs of keys and values
BOnly values
COnly keys
DOrdered list of items
Which of these is a valid key in a dictionary?
AAn index number
BA unique label
CA repeated value
DA number only
If you want to find a value in a dictionary, you use the:
AValue
BIndex
CKey
DPosition
What happens if you try to access a key that does not exist?
AYou get an error or 'not found' message
BYou get the first value
CYou get a random value
DThe dictionary adds the key automatically
Can dictionary keys be changed after they are created?
AKeys can be changed only if values are numbers
BYes, keys can be changed anytime
CKeys change automatically
DNo, keys cannot be changed
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.