
Understanding Python Dictionaries

Quiz
•
Computers
•
11th Grade
•
Hard
Clarkston Ellerby
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to create a dictionary in Python with the keys "name", "age", and "courses"?
`student = {"name": "John", "age": 18, "courses": ["Math", "Science", "History"]}`
`student = ["name": "John", "age": 18, "courses": ["Math", "Science", "History"]]`
`student = ("name": "John", "age": 18, "courses": ["Math", "Science", "History"])`
`student = {"name": "John", "age": 18, "courses": "Math, Science, History"}`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you print the entire dictionary named `student` in Python?
`print student`
`print(student)`
`echo(student)`
`display(student)`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to access the "name" key from the `student` dictionary?
`student["name"]`
`student.name`
`student->name`
`student.get("name")`
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you access the list of courses from the `student` dictionary?
`student["courses"]`
`student.courses`
`student->courses`
`student.get("courses")`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to add a new key-value pair for "grade" in the `student` dictionary, where "Math" is the course and 90 is the grade?
`student["grade"] = {"Math": 90}`
`student["grade"] = "Math": 90`
`student.grade = {"Math": 90}`
`student.add("grade", {"Math": 90})`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If you want to print only the student's age from the `student` dictionary, which of the following would you use?
`print(student["age"])`
`print(student.age)`
`print(student->age)`
`print(student.get("age"))`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements will correctly update the student's age to 19 in the `student` dictionary?
`student["age"] = 19`
`student.age = 19`
`student->age = 19`
`student.set("age", 19)`
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Pseudocode

Quiz
•
9th - 11th Grade
14 questions
Python - True or False?

Quiz
•
7th - 11th Grade
10 questions
Alpha Task Code Quiz Check in

Quiz
•
9th - 12th Grade
10 questions
Comp Sci Unit 2 #9

Quiz
•
11th Grade
15 questions
ICT Application - School Management System

Quiz
•
8th - 11th Grade
5 questions
Codify: Code Pioneers

Quiz
•
9th - 12th Grade
15 questions
Learning SQL

Quiz
•
11th - 12th Grade
15 questions
JavaScript and Graphics

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade