CC103 - Part 2

CC103 - Part 2

University

40 Qs

quiz-placeholder

Similar activities

ôn tập tin học 2

ôn tập tin học 2

University

35 Qs

ICT KiNg College

ICT KiNg College

University

35 Qs

Konsep Sistem Informasi SDLC

Konsep Sistem Informasi SDLC

University

45 Qs

44-86 gramma

44-86 gramma

University

43 Qs

CC103 - Part 2

CC103 - Part 2

Assessment

Quiz

Others

University

Hard

Created by

ALVIN CERTEZA

FREE Resource

AI

Enhance your content

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

40 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of: d = {'a': 1, 'b': 2} print(d['c'])

None

0

Error

[]

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method returns a list of key-value tuple pairs?

keys()

values()

items()

get()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How to safely access a key that may not exist in a dictionary?

dict['key']

dict.get('key')

dict.key

dict.fetch('key')

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of len({'a': 1, 'b': 2, 'a': 3})?

3

2

1

Error

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does dict.update({'c': 3}) do?

Adds key 'c' with value 3

Replaces dictionary

Clears dictionary

Returns error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will dict.pop('x') do if 'x' does not exist?

Returns None

Raises KeyError

Deletes key

Returns 0

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How to loop over dictionary keys and values? for k, v in ___: ...

dict

dict.items()

dict.keys()

dict.values()

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?

Similar Resources on Wayground