Search Header Logo

Unit-V-Set Q & A

Authored by Ajitha Padmanabhan

Computers

Professional Development

Used 2+ times

Unit-V-Set Q & A
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

8 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Indicate all of the following that are syntactically correct for creating a set.

set([1, 2, 3])

set((1, 2, 3))

{1, 2, 3}

[1,2,3]

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

For set s containing values 1, 2, 3, and set t containing 3, 4, 5, which of the following are the correct results for each given set operation?

(a) s | t -> {3}

s & t -> {1, 2, 3, 4, 5}

s - t->{1, 2}

s ^ t -> {1, 2, 4, 5}

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

For set s containing values 1, 2, 3 and set w of type frozenset containing values 'a','b','c', which of the following are valid set operations?

'a' in s

'a' in w

len(s) + len(w)

s.add(4)

w.add('d')

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A dictionary type in Python is an associative data structure that is accessed by a _______________ rather than an index value.

key

value

key value

index

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Associative data structures such as the dictionary type in Python are useful for,

accessing elements more intuitively than by use of an indexed data structure

maintaining elements in a particular order

insert and update

delete and drop

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of the following types can be used as a key in Python dictionaries?

strings

lists

tuples

numerical values

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a syntactically correct sequence, s, for dynamically creating a dictionary using dict(s).

s = [[1: 'one'],

[2: 'two'], [3: 'three']]

s = [[1, 'one'], [2, 'two'], [3, 'three']]

s = {1:'one', 2:'two', 3:'three'}

s ={[1:'one', 2:'two', 3:'three']}

Access all questions and much more by creating a free account

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?