Page 29 - ipp11
P. 29

60.  What is string concatenation?
                Ans.  String concatenation involves combining/adding multiple strings together to form a single longer string.
                 61.  What is a dictionary?
                Ans.  A Python dictionary is a collection of key-value pairs. The elements in a dictionary are indexed by keys
                    which must be unique.
                 62.  What does the items() method of dictionary return?
                Ans.  The items() method returns a list of dictionary (key:value) pairs as tuples.
                 63.  Can list be used as keys in Python dictionaries? Justify your answer.
                Ans.  No, list cannot be used as keys in a dictionary because lists are mutable while keys of the dictionary are
                    immutable by default.

                 64.  What is the purpose of using update() method with dictionary?
                Ans.  The update() method modifies or updates the dictionary with the elements from another dictionary
                    or from another sequence of key-value pairs.
                 65.  How is a dictionary different from a list?
                Ans.  Dictionaries are a mapped sequence that store key-value pairs whereas lists are an ordered sequence or
                    collection of items.
                 66.  What do you mean by concatenation of list? Explain with example.
                Ans.  Concatenation of list means combining two lists.
                      For example,
                     >>>a = [1,2,3,4]
                     >>>b = [5,6,7,8]
                     >>> a+b
                      The output will be:
                    [1,2,3,4,5,6,7,8]
                 67.  Why are Python dictionaries also termed as mappings?
                Ans.  Python dictionaries are called mappings because these are like a collection that allows us to look up for
                    information associated with arbitrary keys.
                 68.  Can we print only keys of a dictionary?
                Ans.  Yes, we can print keys of a dictionary by using keys() method.
                 69.  What are positive and negative indexes in Python?
                Ans.  Python sequences can be indexed in positive and negative numbers. For positive index (i.e., from left to
                    right), 0 is the first index, 1 is the second index and so on. For negative index (i.e., from right to left),
                    –1 is the last index and –2 is the second last index and so on.

                 70.  Name the function used to create an empty dictionary.
                Ans.  dict()
                 71.  What is the purpose of using popitem() function?
                Ans.  popitem() method deletes or removes the last entered key-value pair from a dictionary.
                 72.  What is DBMS?
                Ans.  Database is managed by a software package known as Database Management System (DBMS). DBMS
                    allows us to create, delete, update and maintain databases.

                 73.  What is a relation? What is the difference between a tuple and an attribute?
                Ans.  A relation is a table in which data is arranged in the form of tuples and attributes.
                      •  The horizontal subset of a relation is known as tuple whereas the vertical subset of a relation is known
                       as an attribute.
                 74.  What do you understand by the Degree and Cardinality of a table?
                Ans.  Degree of a table is the total number of attributes present in a table.  Cardinality  of a table is the total
                    number of rows present in a table.
                 75.  What do you understand by Primary key and Candidate key?
                Ans.  An attribute or a set of attributes which is used to identify a tuple uniquely is known as Primary key. If a
                    table has more than one such attribute which identifies a tuple uniquely, capable of becoming a primary
                    key, then all such attributes are known as Candidate keys.
                                                               V.5
   24   25   26   27   28   29   30   31   32   33   34