Python-Lists_Dictionaries

Python-Lists_Dictionaries

University

20 Qs

quiz-placeholder

Similar activities

Python

Python

University

20 Qs

CSC305: TOPIC 7

CSC305: TOPIC 7

University

15 Qs

COMP177 Module 3 Quiz

COMP177 Module 3 Quiz

University

20 Qs

Quizaro

Quizaro

University

20 Qs

8-期中总结

8-期中总结

University

20 Qs

Python Lists Quiz 8

Python Lists Quiz 8

University

24 Qs

loops and iterables in python

loops and iterables in python

University

20 Qs

untitled

untitled

8th Grade - University

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