Search Header Logo

python dictionary

Authored by V. Charles Prabu

Computers

University

Used 18+ times

python dictionary
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Select correct ways to create an empty dictionary

sampleDict = {}

sampleDict = dict()

sampleDict = dict{}

sampleDict = ()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following dictionary operation

dict1 = {"name": "Mike", "salary": 8000}

temp = dict1.get("age")

print(temp)

KeyError: ‘age’

None

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Select the all correct way to remove the key ‘marks‘ from a dictionary

student = { "name": "Emma", "class": 9, "marks": 75 }

student.pop(“marks”)

del student[“marks”]

student.popitem()

dict1.remove(“key2”)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

True

False

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Dictionary keys must be immutable

True

False

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements create a dictionary?

d = {}

d = {“john”:40, “peter”:45}

d = {40:”john”, 45:”peter”}

All of the mentioned

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following Python code snippet?

d = {"john":40, "peter":45}

d["john"]

40

45

“john”

“peter”

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?

Discover more resources for Computers