Python-Lists_Dictionaries

Python-Lists_Dictionaries

University

20 Qs

quiz-placeholder

Similar activities

Sense_The_Bug

Sense_The_Bug

University

15 Qs

COMP177 Mod 8 - Lists & Dictionaries

COMP177 Mod 8 - Lists & Dictionaries

University

16 Qs

Py-Hackathon - Week 2 - Day 2

Py-Hackathon - Week 2 - Day 2

University

15 Qs

Python and data processing test

Python and data processing test

University

16 Qs

Hackathon Quiz

Hackathon Quiz

University

20 Qs

CodeHS Basic Data Structures in Python

CodeHS Basic Data Structures in Python

University

20 Qs

UNIT1-PYTHON

UNIT1-PYTHON

University

20 Qs

Python Quiz - BPLCK105B

Python Quiz - BPLCK105B

University

20 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?