Unit-V-Set Q & A

Unit-V-Set Q & A

Professional Development

8 Qs

quiz-placeholder

Similar activities

Sains Komputer Tingkatan 4 - 2.1.3 Mengenalpasti entiti,..

Sains Komputer Tingkatan 4 - 2.1.3 Mengenalpasti entiti,..

1st Grade - Professional Development

11 Qs

DECI - Week 9 - round

DECI - Week 9 - round

Professional Development

12 Qs

DA100 - MeasureUp -  Test oficial Microsoft

DA100 - MeasureUp - Test oficial Microsoft

Professional Development

12 Qs

Python Collections Quiz

Python Collections Quiz

Professional Development

12 Qs

8255 PPI

8255 PPI

Professional Development

10 Qs

Consults Postgres I

Consults Postgres I

Professional Development

7 Qs

python loop practice

python loop practice

Professional Development

12 Qs

L2_W4_Q2

L2_W4_Q2

Professional Development

3 Qs

Unit-V-Set Q & A

Unit-V-Set Q & A

Assessment

Quiz

Computers

Professional Development

Hard

Created by

Ajitha Padmanabhan

Used 2+ times

FREE Resource

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']}

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

For dictionary d = {'apples':0.66,'pears':1.25,'bananas':0.49}, which of the following correctly updates the price of bananas.

d[2] = 0.52

d[0.49] = 0.52

d['bananas'] = 0.52

d['bananas'] [ 0.52]