1) What is a dictionary in Python? a) A collection of ordered pairs of keys and values b) A type of list c) A collection of functions d) A list of strings 2) How do you define a dictionary in Python? a) d = {} b) d = [] c) d = () d) d = dict() 3) What function is used to add a key-value pair to a dictionary in Python? a) A) append() b) B) insert() c) C) update() d) D) add() 4) Which of the following is a correct way to access the value of a specific key in a Python dictionary? a) A) dict[<key>] b) B) dict.get(<key>) c) C) dict.<key>() d) D) Both A and B 5) Which method is used to get a list of all the values in a Python dictionary? a) A) values() b) B) keys() c) C) items() d) D) lists() 6) What method would you use to retrieve a value for a specific key from a Python dictionary? a) A) get() b) B) find() c) C) extract() d) D) fetch() 7) What will the following code output? a) A) None b) B) 0 c) C) "Not Found" d) D) KeyError 8) Which method would you use to remove a key-value pair from a dictionary in Python? a) A) del b) B) remove() c) C) pop() d) D) Both A and C 9) How can you check if a key exists in a Python dictionary? a) A) key in dictionary b) B) dictionary.has_key(key) c) C) key.exists() d) D) dictionary.check_key(key) 10) What does the keys() method return when called on a dictionary? a) A) A list of values b) B) A list of keys c) C) A dictionary d) D) A tuple of key-value pairs
0%
DICTIONARY
แชร์
แชร์
แชร์
โดย
Stuti023229
Class 11
python
แก้ไขเนื้อหา
สั่งพิมพ์
ฝัง
เพิ่มเติม
กำหนด
ลีดเดอร์บอร์ด
แสดงเพิ่มขึ้น
แสดงน้อยลง
ลีดเดอร์บอร์ดนี้ตอนนี้เป็นส่วนตัว คลิก
แชร์
เพื่อทำให้เป็นสาธารณะ
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานโดยเจ้าของทรัพยากร
ลีดเดอร์บอร์ดนี้ถูกปิดใช้งานเนื่องจากตัวเลือกของคุณแตกต่างสำหรับเจ้าของทรัพยากร
แปลงกลับตัวเลือก
เกมตอบคำถาม
เป็นแม่แบบแบบเปิดที่ไม่ได้สร้างคะแนนสำหรับลีดเดอร์บอร์ด
ต้องลงชื่อเข้าใช้
สไตล์ภาพ
แบบ อักษร
ต้องสมัครสมาชิก
ตัวเลือก
สลับแม่แบบ
แสดงทั้งหมด
รูปแบบเพิ่มเติมจะปรากฏเมื่อคุณเล่นกิจกรรม
เปิดผลลัพธ์
คัดลอกลิงค์
คิวอาร์โค้ด
ลบ
คืนค่าการบันทึกอัตโนมัติ:
ใช่ไหม