Python Sets and Dictionaries Quiz

Python Sets and Dictionaries Quiz

Professional Development

50 Qs

quiz-placeholder

Similar activities

1Rivet's Angular Community Quiz | Dynamic Components, Code Generators, ES-6 Features, Unit Test Cases

1Rivet's Angular Community Quiz | Dynamic Components, Code Generators, ES-6 Features, Unit Test Cases

Professional Development

45 Qs

Microsoft Azure Fundamentals AZ-900 ENG #1

Microsoft Azure Fundamentals AZ-900 ENG #1

University - Professional Development

55 Qs

Davinci Resolve 17 Fusion 101

Davinci Resolve 17 Fusion 101

11th Grade - Professional Development

45 Qs

Security+ Authentication Design Concepts

Security+ Authentication Design Concepts

Professional Development

50 Qs

Robotic Process Automation by Chayan Bhattacharjee

Robotic Process Automation by Chayan Bhattacharjee

Professional Development

50 Qs

Technical Evaluation - 101 - 2024

Technical Evaluation - 101 - 2024

Professional Development

50 Qs

Python Programming

Python Programming

Professional Development

50 Qs

Code A Thone Finals

Code A Thone Finals

Professional Development

45 Qs

Python Sets and Dictionaries Quiz

Python Sets and Dictionaries Quiz

Assessment

Quiz

Computers

Professional Development

Medium

Created by

ankush joshi

Used 29+ times

FREE Resource

50 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct syntax to create a set in Python?

set = {1, 2, 3}

set = [1, 2, 3]

set = (1, 2, 3)

set = <1, 2, 3>

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is not allowed in a set?

Integer

String

List

Tuple

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Sets in Python are:

Ordered

Mutable

Immutable

Duplicated

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of: len({1, 2, 2, 3})?

2

3

4

5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you add an element to a set s?

s.append(x)

s.add(x)

s.insert(x)

s.extend(x)

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following removes all elements from a set?

s.remove()

s.clear()

del s[]

s.popall()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The method discard() in sets:

Removes the element and throws an error if not found

Removes the element without error if not found

Adds a new element

Sorts the set

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?