Problem Solving using Python and R - UNIT II - Dictionary

Quiz
•
Computers
•
12th Grade
•
Hard
MS.SHYAMALADEVI C
Used 4+ times
FREE Resource
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
Similar Resources on Wayground
14 questions
Python: списки, кортеж, словник, множина

Quiz
•
9th - 12th Grade
20 questions
Python Programming II CSE A

Quiz
•
12th Grade - University
10 questions
Python Generators

Quiz
•
10th Grade - University
20 questions
Data handling using pandas and Data visualization

Quiz
•
12th Grade
10 questions
Python Pandas

Quiz
•
12th Grade
14 questions
Python Syntax

Quiz
•
6th - 12th Grade
20 questions
Python Basics

Quiz
•
12th Grade
20 questions
คำสั่งพื้นฐานในภาษา Python (เก็บคะแนนครั้งที่ 2)

Quiz
•
12th Grade
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
Discover more resources for Computers
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
62 questions
Spanish Speaking Countries, Capitals, and Locations

Quiz
•
9th - 12th Grade
20 questions
First Day of School

Quiz
•
6th - 12th Grade
6 questions
Maier - AMDM - Unit 1 - Quiz 1 - Estimation

Quiz
•
12th Grade
21 questions
Arithmetic Sequences

Quiz
•
9th - 12th Grade
21 questions
9th Grade English Diagnostic Quiz

Quiz
•
9th - 12th Grade
7 questions
Characteristics of Life

Interactive video
•
11th Grade - University