Python-Lists_Dictionaries

Python-Lists_Dictionaries

University

20 Qs

quiz-placeholder

Similar activities

Demo DS-A ASHV Quiz

Demo DS-A ASHV Quiz

University

17 Qs

Lists and Tuples

Lists and Tuples

University

20 Qs

Sense_The_Bug

Sense_The_Bug

University

15 Qs

COMP177 Mod 8 - Lists & Dictionaries

COMP177 Mod 8 - Lists & Dictionaries

University

16 Qs

Python Quiz - 4 Lists,Loops,String Manipulation

Python Quiz - 4 Lists,Loops,String Manipulation

University

15 Qs

Python Collection Data Type

Python Collection Data Type

University

20 Qs

CodeHS Basic Data Structures in Python

CodeHS Basic Data Structures in Python

University

20 Qs

PyTron

PyTron

University

15 Qs

Python-Lists_Dictionaries

Python-Lists_Dictionaries

Assessment

Quiz

Computers

University

Hard

Created by

Anik Acharjee

Used 2+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code?

   

   fruits = ['apple', 'banana', 'cherry']

   print(fruits[1])

 apple

banana

cherry

['apple', 'banana', 'cherry']

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you add an element to the end of a list?

list.add(element)

list.append(element)

list.insert(element)

list.push(element)

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the correct way to create an empty dictionary?

dict = {}

dict = []

dict = ()

dict = set()

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you access the value of a key in a dictionary?

dict[key]

dict(key)

dict.get(key)

Both dict[key] and dict.get(key)

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code?

   numbers = [1, 2, 3, 4, 5]

   print(len(numbers))

4

 5

6

[1, 2, 3, 4, 5]

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you remove the last element from a list?

list.remove()

list.pop()

list.delete()

list.cut()

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the correct way to check if a key exists in a dictionary?

if key in dict:

if key exists in dict:

if dict.haskey(key):

if dict.contains(key):

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?