Already Solved Answers.
What is the value of the variable phones after the following code executes?
phones={'John' : '5555555', 'Julie': '5557777'}
phones [John'} =5556666' - Answer This code is invalid
In a dictionary, you can use a____ to locate a specific value - Answer key
The issubset( ) method can be used to determine whether set1 is a subset of set2 - Answer
True
The union of two sets is a set that contains only the elements that appear in both sets - Answer
False
The elements in a dictionary are stored in ascending order, by the keys of the key-value pairs. -
Answer False
If you try to retrieve a value from a dictionary using a nonexistent key, a KeyError exception is
raised - Answer True
Sets are Immutable - Answer False
The difference of set1 and set2 is a set that contains only the elements that appear in set1 but
do not appear in set2. - Answer True
Sets are created using curly braces { }. - Answer False
You would typically use a for loop to iterate over the elements in a set. - Answer True
A dictionary can include the same value several times but cannot include the same key several
times. - Answer True
, What is the number of the first index in a dictionary? - Answer Dictionaries are not indexed by
number.
What will the result of the following code?
ages={'Aaron' : 6, 'Kelly' : 3, 'Abigail' :1}
value=ages['Briana'] - Answer KeyError
An object is a stand-alone program but is used by programs that need its service. - Answer
False
Which section in the UML holds the list of the class's methods? - Answer third section
The self parameter need not to be named self but it is strongly recommended to do so, to
conform with standard practice. - Answer True
What does the acronym UML stand for? - Answer Unified Modeling Language
The procedures that an object performs are called? - Answer methods
In a UML diagram the first section holds the list of the class's methods. - Answer False
Procedures operate on data items that are separate from the procedures. - Answer True
All instances of a class share the same values of the data attributes in the class. - Answer False
What type of method provides a safe way to code outside a class to retrieve the values of
attributes, without exposing the attributes in a way that could allow them to be changed by
code outside the method? - Answer accessor
A mutator method has no control over the way that a class's data attributes are modified -
Answer False
Which section in the UML hold the list of the class data attributes - Answer second section