Python Sets

Quiz
•
Computers
•
University
•
Hard
Sangameshwar Biradar
Used 222+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
20 sec • 1 pt
Which of the following are true for objects of Python’s set type:
The order of elements in a set is significant.
A given element can’t appear in a set more than once.
Sets are mutable.
A set may contain elements that are mutable.
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will be the output of the following Python code? *
x={1,3,5}
y={2,4,6}
x+y
{1,3,5,2,4}
{1,3,5,2,4,6}
Error as the duplicate item 6 is present in both sets
Error as unsupported operand type(s) for +: 'set' and 'set'
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following functions will return the symmetric difference between two sets, x and y? *
x | y
x ^ y
x & y
x – y
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will be the output of the following Python code?
x = {4,7,8,8,9}
print(x)
{4, 7, 9}
{8, 9, 4, 7}
{4, 7, 8, 8, 9}
Error
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following statements is used to create an empty set?
{ }
set()
[ ]
( )
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will be the output of the following Python code?
x = {6,5}
y = {2,3,5,6}
x<y
{1,2}
True
False
Invalid operation
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
The _________ function removes the first element of a set and the last element of a list.
remove
pop
discard
dispose
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Code Combat

Quiz
•
University
10 questions
V1 unit 3 and 4Quiz

Quiz
•
University
10 questions
Scientific Computing with Python-Basics

Quiz
•
University
14 questions
AES: Coding Fundamentals Lessons 1 and 2

Quiz
•
7th Grade - Professio...
10 questions
Python Dictionaries

Quiz
•
University
10 questions
DATA STRUCTURES ACTIVITY OF THE WEEK

Quiz
•
University
10 questions
H466 - Arrays, Records, Tuples and Lists

Quiz
•
11th Grade - University
11 questions
Python Data Types Quiz

Quiz
•
10th Grade - University
Popular Resources on Wayground
15 questions
Hersheys' Travels Quiz (AM)

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
30 questions
Lufkin Road Middle School Student Handbook & Policies Assessment

Quiz
•
7th Grade
20 questions
Multiplication Facts

Quiz
•
3rd Grade
17 questions
MIXED Factoring Review

Quiz
•
KG - University
10 questions
Laws of Exponents

Quiz
•
9th Grade
10 questions
Characterization

Quiz
•
3rd - 7th Grade
10 questions
Multiply Fractions

Quiz
•
6th Grade