PYTHON SET

PYTHON SET

Professional Development

5 Qs

quiz-placeholder

Similar activities

Confluent

Confluent

Professional Development

10 Qs

Understanding Cascading Style Sheets

Understanding Cascading Style Sheets

Professional Development

10 Qs

Máster SAPUI5 (C24C313) - Clase #13

Máster SAPUI5 (C24C313) - Clase #13

Professional Development

4 Qs

Mastering CSS Concepts

Mastering CSS Concepts

Professional Development

10 Qs

Web Development Mastery

Web Development Mastery

Professional Development

10 Qs

Python Conditional and Looping Statements Quiz

Python Conditional and Looping Statements Quiz

Professional Development

10 Qs

ESDE GOTH Stack Quiz

ESDE GOTH Stack Quiz

Professional Development

10 Qs

Ethical Hacking Kali Linux Part 3

Ethical Hacking Kali Linux Part 3

Professional Development

10 Qs

PYTHON SET

PYTHON SET

Assessment

Quiz

Information Technology (IT)

Professional Development

Hard

Created by

Dr.S.Vidhya KGCAS

Used 5+ times

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to create an empty set in Python?

  • set = {}

  • set()

  • []

  • ()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you add an element 'x' to a set s?

  • s.add('x')

  • s.append('x')

  • s.insert('x')

  • s.extend('x')

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the result of the following code?

s = {1, 2, 3}

s.discard(4)

  • Raises a KeyError

  • Removes 4 from the set

  • adds 4 to the set

  • Does nothing

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following operations will return the union of two sets a and b?

  • a.union(b)

  • a + b

  • a | b

  • Both A and C

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the difference() method in Python sets?

  • ATo find elements present in both sets

  • To find elements present in the first set but not in the second

  • To remove common elements

  • To add elements from two sets