Python Sets and Dictionaries Quiz

Python Sets and Dictionaries Quiz

Professional Development

50 Qs

quiz-placeholder

Similar activities

Perancangan Pemrograman dan Database

Perancangan Pemrograman dan Database

University - Professional Development

50 Qs

Security+ Authentication Design Concepts

Security+ Authentication Design Concepts

Professional Development

50 Qs

Critical Thinking

Critical Thinking

Professional Development

50 Qs

WP 11-15

WP 11-15

Professional Development

55 Qs

DFH Class XII

DFH Class XII

12th Grade - Professional Development

46 Qs

Python Basic 101

Python Basic 101

Professional Development

50 Qs

Python Programming

Python Programming

Professional Development

50 Qs

9628-09 City & Guilds Level 3 Award in Coding and Logic Quiz 3

9628-09 City & Guilds Level 3 Award in Coding and Logic Quiz 3

11th Grade - Professional Development

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