Mastering Python Dictionaries Quiz

Mastering Python Dictionaries Quiz

12th Grade

11 Qs

quiz-placeholder

Similar activities

Computational Thinking - 1

Computational Thinking - 1

11th - 12th Grade

10 Qs

Apple quiz

Apple quiz

5th Grade - University

14 Qs

ICT Unit Test Topic : DBMS - Access

ICT Unit Test Topic : DBMS - Access

8th - 12th Grade

15 Qs

مسابقة خفيفة

مسابقة خفيفة

9th - 12th Grade

10 Qs

Network Security concept

Network Security concept

11th - 12th Grade

10 Qs

Vocabulary of Computer

Vocabulary of Computer

12th Grade

15 Qs

CSP Unit 13 Practice Test

CSP Unit 13 Practice Test

9th - 12th Grade

15 Qs

Mastering Python Dictionaries Quiz

Mastering Python Dictionaries Quiz

Assessment

Quiz

Computers

12th Grade

Practice Problem

Hard

Created by

Devin Lachapelle

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to create an empty dictionary in Python?

empty_dict = []

empty_dict = {}

empty_dict = ()

empty_dict = set()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the dictionary student = {"name": "Alice", "age": 18}, how would you access the value associated with the key "name"?

student["name"]

student.name

student{"name"}

student

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you add a new key-value pair "grade": "A" to the dictionary student = {"name": "Alice", "age": 18}?

student.add("grade", "A")

student["grade"] = "A"

student.create({"grade": "A"})

student + "grade":"A"

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?
student = {"name": "Alice", "age": 18}
print(student["grade"])

None

"A"

KeyError

0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the result of the following code? ```python student = {"name": "Alice", "age": 18} student["age"] = 19 print(student) ```

`{"name": "Alice", "age": 18}`

`{"name": "Alice", "age": 19}`

`{"name": "Alice", "age": 18, "age": 19}`

`Error`

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? ```python student = {"name": "Alice", "age": 18} for key, value in student.items(): print(key, value) ```

`name Alice age 18`

`("name", "Alice") ("age", 18)`

`name: Alice, age: 18`

`name Alice \n age 18`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you get a list of all values in a dictionary `student = {"name": "Alice", "age": 18}`?

`student.values()`

`list(student)`

`student.keys()`

`student.items()`

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?