Python Dictionary and List

Python Dictionary and List

9th Grade

10 Qs

quiz-placeholder

Similar activities

9.1.5 - Starter Quiz

9.1.5 - Starter Quiz

7th - 11th Grade

14 Qs

Computer Programming-Python CodeHS

Computer Programming-Python CodeHS

9th Grade

10 Qs

Python Basics - Quiz

Python Basics - Quiz

8th - 11th Grade

10 Qs

6.1 Guided Notes - Dictionary and Data Structures Quiz

6.1 Guided Notes - Dictionary and Data Structures Quiz

9th Grade

15 Qs

KS4 Programming Techniques (1)

KS4 Programming Techniques (1)

8th - 10th Grade

10 Qs

Advance Python

Advance Python

KG - Professional Development

10 Qs

Python Final Assessment

Python Final Assessment

4th - 12th Grade

10 Qs

Databases Quiz 3

Databases Quiz 3

7th - 11th Grade

7 Qs

Python Dictionary and List

Python Dictionary and List

Assessment

Quiz

Computers

9th Grade

Medium

Created by

Immanuel Gunawan

Used 6+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a list and a dictionary in Python?

In a list, elements are accessed by their position (index), while in a dictionary, elements are accessed by keys.

Dictionaries are ordered collections, while lists are unordered.

Lists can only store integers, while dictionaries can store any data type.

In a list, elements are accessed by keys, while in a dictionary, elements are accessed by their position (index).

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access an element in a list by its index?

myList(index)

myList{index}

myList[index]

myList.index

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the syntax to create an empty dictionary in Python?

my_dict = {}

my_dict = []

my_dict = dict()

my_dict = set()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can a list contain elements of different data types in Python?

Sometimes

Yes

Rarely

No

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you add a key-value pair to a dictionary in Python?

dictionary_name[key, value]

dictionary_name.add(key, value)

dictionary_name.insert(key, value)

dictionary_name[key] = value

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the method to remove the last element from a list in Python?

list_name.pop(-1)

list_name.remove(-1)

list_name.delete(-1)

list_name.pop()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you try to access a key that does not exist in a dictionary?

ValueError

KeyError

AttributeError

TypeError

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?