1/53
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
Dictionaries are sometimes also called maps.
True
Which of the following are valid elements that can be added to a set?
both strings and tuples
In Python, we can get a collection of all the values by calling the .values() method on a dict.
True
Dictionaries are immutable.
False |
Dictionaries are sorted in alphabetical order by key.
False
Dictionary keys can be mutable.
False
In Python, we can get a collection of all the key-value pairs by calling the .items() method on a dict.
True
Dictionaries are a collection type.
True
If you have two sets and you wanted to find out which elements are contained by both sets, which set operation would you use?
intersection
In Python, we can get a collection of all the keys by calling the .keys() method on a dict.
True
Dictionary Keys can be mutable.
False
Sets can contain duplicate items.
False
Tuples are mutable.
False
Which of the following would allow you to iterate through the keys and values of a dict? Assume the variable ‘d’ is a dict.
for k, v in d.items():
Which of the following are properties of tuples.
All of the above
if you have two sets and you wanted to find out which elements are contained by both sets, which set operation would you use
intersection
a recursive function is one which calls itself in the definition.
True
There are certain problems that can ONLY be solved by using recursion.
False
There are never any performance repercussions from using recursion.
False
The ‘base case’ in a recursive function is one where the answer is known immediately and can be returned without doing any work.
True
A ‘recursive case’ in a recursive function is one where the function makes a call to itself.
True
Which of the following is true about the input to the recursive case in a recursive function.
it should make the problem smaller.
Which of the following is a natural, real-world use case for recursion?
traversing file systems.
which of the following uses showcases the performance drawbacks of using recursion.
calculating fibbonacci numbers.
which of the following is a recursive function that would behave correctly (i.e no stack overflows, no exceptions, etc)
def my_recursive_func(num):
if num <= 1:
print('done')
else:
my_recursive_func(num - 1)Refactoring is the process of editing code you’ve already written to improve the quality, readability, and/or maintainability of the code.
True
Dunder methods have no special significance and are treated just like other methods.
False
A variable that’s created in a function definition is also in scope outside that function.
False
An object’s unique ID that corresponds to its memory address can be accessed with the ‘id()’ function.
True
Objects are NOT instances of a class. They are a separate concept in Python.
False
Say there is a class called ‘Log’ and you create an instance of that class with the variable ‘my_log’. The type of ‘my_log’ is <Class>.
False
Class methods cannot return values like functions can.
False
Class methods can return values as long as they aren’t held in instance variables.
False
A class’s constructor gets called when a new instance of that class is created.
True
Which of the following creates a new instance of the class ‘LoginManager’?
my_instance = LoginManager()In Python all objects are descendants (i.e. inherit from) the built-in object class.
True
Only a single subclass can inherit from any given superclass.
False
Assume that there’s a class called SubClass that inherits from another class called SuperClass. In’s impossible to inherit from SubClass because it’s already a child.
False
The following Python class definition does not inherit from anything.
class ExampleClass:
'''a simple class that does nothing'''False
Markup languages are languages that use predetermined characters and/or symbols to annotate text giving semantic meaning and structure to the document.
True
HTML has self-closing tags that open and close themselves.
True
HTML has open-ended tags that don’t need to be closed.
False
Method overriding is the process of
creating a new implementation/definition of a method that was
previously defined in an ancestor class
Operator overloading is the process of
Adding a definition for an operator’s dunder method so that it can be used with custom behavior for your class.
Which of the following is true about calling a method on an object.
Python will first look for the definition of that method in the
object's type (i.e. class), then through all its ancestors until it
finds a definition or throws an exception if there are no more
ancestors.
HTML is a
markup language
The main semantic component of HTML is the
tag
HTML attributes are
key-value pairs
An HTML attribute lets you
change/modify/specify properties of an HTML tag