Python Sets

Python Sets

Assessment

Quiz

Computers

9th - 12th Grade

Practice Problem

Easy

Created by

surag patel

Used 1+ times

FREE Resource

Student preview

quiz-placeholder

32 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which one of these is a set?

myset = ('apple', 'banana', 'cherry')

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

myset = {'apple', 'banana', 'cherry'}

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Set items cannot be removed after the set has been created.

True

False

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A set cannot have two items with the same value.

True

False

4.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Select the correct function for returning the number of items in a set:
fruits = {'apple', 'banana', 'cherry'}
print(___________(fruits))

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

True or False. You can access set items by referring to the index.

True

False

6.

FILL IN THE BLANK QUESTION

1 min • 1 pt

Check if "apple" is present in the fruits set.

fruits = {"apple", "banana", "cherry"}

if "apple" _______ fruits: print("Yes, apple is a fruit!")

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following code:
thisset = {'apple', 'banana', 'cherry'}
print('banana' not in thisset)
What will be the printed result?

True

False

{'apple', 'cherry'}

Create a free account and access millions of resources

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?