Python dictionary

Python dictionary

Assessment

Flashcard

Others

University

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

7 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Which symbol surrounds a dictionary?

Back

{

2.

FLASHCARD QUESTION

Front

What data type is this?
quiz = {"Do you help out at home? ":"yes",        
"Do you beleive in Santa? ":"yes"}
}

Back

dictionary

3.

FLASHCARD QUESTION

Front

Given the dictionary person = {"name": "Alice", "age": 30}, how would you access Alice's age? Options: person[age], person["Alice", "age"], person.age, person["age"]

Back

person["age"]

4.

FLASHCARD QUESTION

Front

Suppose d = {“john”:40, “peter”:45}, to delete the entry for “john” what command do we use? Options: d.delete(“john”:40), d.delete(“john”), del d[“john”], del d(“john”:40)

Back

del d[“john”]

5.

FLASHCARD QUESTION

Front

What will be the output of the following Python code snippet?
d = {"john":40, "peter":45}
d["john"]

Back

40

6.

FLASHCARD QUESTION

Front

Items are accessed by their position in a dictionary and All the keys in a dictionary must be of the same type.

Back

False

7.

FLASHCARD QUESTION

Front

What is the output of the following dictionary operation: dict1 = {"name": "Mike", "salary": 8000}; temp = dict1.get("age"); print(temp)?

Back

None

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?