Problem Solving using Python and R - UNIT II - Dictionary

Problem Solving using Python and R - UNIT II - Dictionary

12th Grade

15 Qs

quiz-placeholder

Similar activities

Python with DataScience

Python with DataScience

7th Grade - University

10 Qs

Computer Lab Rules

Computer Lab Rules

9th - 12th Grade

13 Qs

Podstawy Pythona

Podstawy Pythona

9th - 12th Grade

10 Qs

REMIDI PROGDAS

REMIDI PROGDAS

12th Grade

15 Qs

INTERNET CONNECTION

INTERNET CONNECTION

12th Grade

13 Qs

Test Your Knowledge Part 2

Test Your Knowledge Part 2

1st - 12th Grade

10 Qs

Conditionals

Conditionals

9th - 12th Grade

18 Qs

Virtual Private Server

Virtual Private Server

12th Grade

15 Qs

Problem Solving using Python and R - UNIT II - Dictionary

Problem Solving using Python and R - UNIT II - Dictionary

Assessment

Quiz

Computers

12th Grade

Practice Problem

Hard

Created by

MS.SHYAMALADEVI C

Used 4+ times

FREE Resource

AI

Enhance your content in a minute

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

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct way to create a dictionary in Python?

my_dict = {1: 'one', 2: 'two'}

my_dict = (1: 'one', 2: 'two')

my_dict = [1: 'one', 2: 'two']

my_dict = <1: 'one', 2: 'two'>

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access the value associated with the key 'name' in the dictionary person = {'name': 'Alice', 'age': 25}?

person.name

person['name']

person.get('name')

Both B and C

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method would you use to remove a key-value pair from a dictionary?

remove()

delete()

pop()

discard()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? python my_dict = {'a': 1, 'b': 2} print(my_dict.get('c', 3))

None

3

KeyError

0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following statements is true about Python dictionaries?

Keys must be mutable.

Values must be unique.

Dictionaries are ordered collections.

Keys must be unique.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you check if a key exists in a dictionary?

key in dict

dict.has_key(key)

dict.contains(key)

key.exists(dict)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? python my_dict = {'x': 10, 'y': 20} my_dict['x'] += 5 print(my_dict['x'])

10

15

20

25

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

Already have an account?