The following code will return data as ______________
1.List
2.Tuple
3.Dictionary
4.None of the above
1,2,3 are the ______________ in the following dictionary. D = {1 : “Oneâ€, 2 : “Twoâ€, 3 : “Threeâ€}
1.Keys
2.Values
3.Items
4.None of the above
A = {“A†: “Appleâ€, “B†: “Ballâ€, “C†: “Catâ€} Which of the following statement will return : dict_items([(‘A’, ‘Apple’), (‘B’, ‘Ball’), (‘C’, ‘Cat’)])
1.print(A.keys( ))
2.print(A.values( ))
3.print(A.Items( ))
4.print(A.get( ))
All elements in dictionary are separated by _________
1.Semicolon(;)
2.Comma( ,)
3.Semicolon(;)
4.dot(.)
Choose the correct statement Assertion (A) : Items in dictionaries are unordered. Reason (R) : We may not get back the data in the same order in which we had entered the data initially in the dictionary.
1.A is true but R is false
2.A is false but R is true
3.Both A and R are false
4.Both A and R are true and R is the correct explanation of A
Choose the correct statement : Statement A : Dictionaries are mutable. Statement B : Contents of the dictionary can not changed after it has been created
1.Statement A is True
2.Statement B is True
3.Both the statements are True
4.Statement A is True and Statement B is False
Dictionaries in python are _______
1.Mutable data type
2.Non-Mutable data type
3.Mapping data type
4.Both a and c
Dictionary is a ___________ data type.
1.Sequence
2.Mapping
3.Ordered
4.None of the above
Following statement return values in the form of _______ >>> D1.keys() #D1 is a dictionary
1.tuple
2.list
3.string
4.dictionary
In dictionary Keys and values are separated by ________________
1.Colon (:)
2.Comma( ,)
3.Semicolon(;)
4.dot(.)
Key – value concept is in ____
1.List
2.String
3.Dictionary
4.Tuple
Keys in dictionary are _____________ .
1.Mutable
2.Immutable
3.antique
4.integers
Keys of dictionary must be _______________
1.antique
2.unique
3.mutable
4.integers
pop( ) function delete and ____ the element of dictionary.
1.display
2.return
3.not return
4.add
The following code is an example of _______ N = {A: {'name': 'Ravi', 'age': '5', 'sex': 'M'}, B: {'name': 'Golu', 'age': '2', 'sex': 'F'}}
1.Normal Dictionary
2.Nested Dictionary
3.Empty Dictionary
4.All the above
The key-value pair in dictionary is called ____
1.item
2.pair item
3.paired value
4.value
Traversing a dictionary can be done using ____________
1. if statement
2.loop
3.jump statement
4.None of the above
What type of error is returned by the following code : a={'a' : "Apple", 'b' : "Banana" , 'c' : "Cat"} print(a[1])
1.KeyError
2.KeyNotFoundError
3.NotFoundError
4.Syntax Error
Which function helps to merge dictionary ‘D1’ and ‘D2’?
1.merge( )
2.append( )
3.update( )
4. get( )
Which of the following are immutable data type? a. String b. Tuple c. List d. Dictionary
1.a and c
2. b and d
3.a and b
4.c and d
Which of the following function create a dictionary from a sequence of key-value pairs
1.dictionary( )
2.dict( )
3.create( )
4.convert( )
Which of the following is an example of dictionary?
1.L = [ ]
2.C = ( )
3.D = { }
4.None of the above
Which of the following is feature of Dictionary?
1.Keys are unique within a dictionary.
2.Keys are unique within a dictionary.
3.Dictionary is mutable.
4.All of the above
Which of the following is feature of Dictionary?
1.Keys are unique within a dictionary.
2.Keys are unique within a dictionary.
3.Dictionary is mutable.
4.All of the above
Which of the following is feature of Dictionary?
1.Keys are unique within a dictionary.
2.Keys are unique within a dictionary.
3.Dictionary is mutable.
4.All of the above
Which of the following is feature of Dictionary?
1.Keys are unique within a dictionary.
2.Keys are unique within a dictionary.
3.Dictionary is mutable.
4.All of the above
Which of the following is feature of Dictionary?
1.Keys are unique within a dictionary.
2.Keys are unique within a dictionary.
3.Dictionary is mutable.
4.All of the above
Which of the following is feature of Dictionary?
1.Keys are unique within a dictionary.
2.Keys are unique within a dictionary.
3.Dictionary is mutable.
4.All of the above
Which of the following is feature of Dictionary?
1.Keys are unique within a dictionary.
2.Keys are unique within a dictionary.
3.Dictionary is mutable.
4.All of the above
Which of the following is feature of Dictionary?
1.Keys are unique within a dictionary.
2.Keys are unique within a dictionary.
3.Dictionary is mutable.
4.All of the above
Which of the following is not method of dictionary?
1.len( )
2.pop( )
3.del ( )
4.update( )
Which of the following is used to delete an element from Dictionary?
1.pop( )
2.delete
3.remove
4.None of the above
Which statement is not correct in reference to the following code? A = {1 : "One", 2 : "Two", 3 : "Three"} A[4] = "Four"
1.It will add value at the end of dictionary.
2.It will modify value if the key already exist.
3.It will add value in between of the dictionary.
4.All the above
Which statement is used to create an empty dictionary? a.
1.d1 = { }
2.d1 = ( )
3. d1 = dict{ }
4.d1 = [ ]
Write the output of the following : A = {"A" : "Apple", "B" : "Ball", "C" : "Cat"} print(A.get("D"))
1.KeyNotFoundError
2.Name Error
3.Type Error
4.None
Write the output of the following : A = {1 : "One", 2 : "Two", 3 : "Three"} print("One" in A)
1.True
2.False
3.Error
4.One
Write the output of the following : d1 = {"a" : 50, "b" : 50} d2 = {"a" : 500, "b" : 50} print(d1 > d2)
1.True
2.False
3.Error
4.None of the above
Write the output of the following code : A = {1 : "One", 2 : "Two", 3 : "Three"} B = {'A' : "Apple", 'B' : "Bat", 'C' : "Cat", 'D' : "Doll"} A.update(B) #print(B.values()) print(B)
1. {‘A’ : ‘Apple’ , ‘B’ : ‘Bat’ , ‘C’ : ‘Cat’ , ‘D’ : ‘Doll’}
2.{1 : “One†, 2 : “Two†, 3 : “Threeâ€}
3.{1: ‘One’ , 2: ‘Two’ , 3: ‘Three’ , ‘A’: ‘Apple’ , ‘B’: ‘Bat’ , ‘C’: ‘Cat’ , ‘D’: ‘Doll’}
4.None of the above
Write the output of the following code : A = {1 : "One", 2 : "Two", 3 : "Three"} B = {'A' : "Apple", 'B' : "Bat", 'C' : "Cat", 'D' : "Doll"} print(A.get(4,"Key Not Found"))
1.KeyError
2.Key Not Found
3.None
4.Syntax Error
Write the output of the following code : A = {1 : "One", 2 : "Two", 3 : "Three"} print(A[2] + A[1])
1.Error
2.TwoOne
3.21
4.{1 : “Oneâ€, 2 : “Twoâ€, 3 : “Threeâ€}
Write the output of the following code : a={'a' : "Apple", 'b' : "Banana" , 'c' : "Cat"} a['a']="Anar" print(a)
1.{‘a’: ‘Anar’, ‘b’: ‘Banana’, ‘c’: ‘Cat’}
2.Error
3.{‘a’ : “Apple, ‘a’: ‘Anar’, ‘b’: ‘Banana’, ‘c’: ‘Cat’}
4.None of the above
Write the output of the following: A = {1 : "One", 2 : "Two", 3 : "Three"} B = {'A' : "Apple", 'B' : "Bat", 'C' : "Cat", 'D' : "Doll"} for i in A: print(i)
1.1 2 3
2.1 2 3
3.{1 : “Oneâ€, 2 : “Twoâ€, 3 : “Threeâ€}
4.None of the above
_______ datatype fall under mapping
1.List
2.Tuple
3.Dictionary
4.String
_______ is the suitable data type for keys of dictionary in python.
1.Number
2.String
3.Tuple
4.All the above
_________ function returns the number of key: value pairs of the dictionary.
1.total( )
2.len( )
3.length( )
4.items( )
_________ function returns the value corresponding to the key passed as the argument.
1.get( )
2.values( )
3.update( )
4.update( )