Computer Science - Informatics Practices Class XI/XII Python Dictionary Solved Test Part 3

Computer Science - Informatics Practices Class XI/XII Python Dictionary Solved Test  Part 3


Q1. Can we add new values in an existing dictionary?
Q2. Write a code to add the following key-value to a given dictionary.
    a = {'Class':'VI','Sec':'B','Rollno' : 1}
    
        
Q3. Can we do modification in existing key value pair?

Q4. Write the code to change the class of given
dictionary to 'VII'
a = {'Class':'VI','Sec':'B','Rollno' : 1}

Q5. What do you mean by update() in context of
dictionary in python
   
Q6. What is the difference between del command and pop() 
     function in dictionaries?

Q7. Write the output of the following:
    a = {'Class':'VI','Sec':'B','Rollno' : 1}
    print('Class' in a)
    print('sec' in a)

Q8. Can there be any dictionary without key or
without value?if yes then give example.

Q9. Which function return the count of
    key-value pairs in the given dictionary.

Q10. Which function removes all the items from
    dictionary?


No comments:

Post a Comment

Most Recently Published

File Handling Test 6

 File Handling Test 6 Q1 . Do we need to use the close() function when we use 'with' statement to open a file? Q2. Which mode you wi...

CS - IP Assignment/Worksheet