Given the following dictionaries

dict_exam={"Exam":"AISSCE", "Year":2023}

dict_result={"Total":500, "Pass_Marks":165}

 

Which statement will merge the contents of both dictionaries?

a. dict_exam.update(dict_result)

b. dict_exam + dict_result

c. dict_exam.add(dict_result)

d. dict_exam.merge(dict_result)

 

Answer:

The update( ) method is used to merge one dictionary into another in python.

Checking the options:

  • (a) dict_exam.update(dict_result)

[Class 12] Given dictionaries - dict_exam={"Exam":"AISSCE", "Year":202 - CBSE Class 12 Sample Paper for 2023 Boards

  • (b) dict_exam + dict_result 

part 2 - Question 3 - CBSE Class 12 Sample Paper for 2023 Boards - Solutions to CBSE Sample Paper - Computer Science Class 12 - Computer Science - Class 12

  • (c) dict_exam.add(dict_result)

part 3 - Question 3 - CBSE Class 12 Sample Paper for 2023 Boards - Solutions to CBSE Sample Paper - Computer Science Class 12 - Computer Science - Class 12

  • (d) dict_exam.merge(dict_result)

part 4 - Question 3 - CBSE Class 12 Sample Paper for 2023 Boards - Solutions to CBSE Sample Paper - Computer Science Class 12 - Computer Science - Class 12

So, the correct answer is (a).

Remove Ads
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh is an IIT Kanpur graduate and has been teaching for 16+ years. At Teachoo, he breaks down Maths, Science and Computer Science into simple steps so students understand concepts deeply and score with confidence.

Many students prefer Teachoo Black for a smooth, ad-free learning experience.