This architecture is the first instance of a stored-program digital computer
von Nuemann architecture
What is used to define a function in Python?
The def keyword.
What is the syntax for a shallow vs a deep copy in Python?
copy.copy() - shallow
copy.deepcopy() - deep
What is the syntax for creating a subclass that inherits from multiple superclasses in Python
class Subclass(SuperClass1, SuperClass2):
This term refers to simplifying the behavior and attributes of data for humans in programming
data abstration
What is the main difference between instance variables and class variables?
Instance variables are unique to each object, while class variables are shared by all instances.
What is the difference between a deep copy and a shallow copy?
A shallow copy references the original object, while a deep copy creates new instances of all objects recursively
How does Python resolve method calls when a class inherits from multiple superclasses
Python uses the method resolution order (MRO) to determine which method to call
Name one computational paradigm besides imperative programming
logic
scripting
object-oriented
How do you add a method or variable to a class or instance “on the fly” in Python?
You can add methods or variables by defining them outside the class and binding them to the object or class instance.
Why are deep and shallow copies only relevant for compound objects in Python?
Compound objects contain other objects, and copying behavior can differ based on whether you copy references or create entirely new objects.
How does Python's dynamic typing work
Types are determined at runtime, allowing variables to hold objects of different types during their lifetime
A program that translates high-level code into machine code at run time
an interpreter
What is a constructor, and what does it do in Python classes?
A constructor, defined by __init__, sets instance variables when creating an object.
Explain the difference in how a shallow copy and a deep copy would affect a list that contains other lists
A shallow copy would copy references to the inner lists, while a deep copy would recursively copy each list, making completely independent inner lists
How does dynamic binding work in Python
Method calls are resolved at runtime based on the actual type of the object
These two types of programming language abstractions simplify control and data for the programmer
control abstraction and data abstractions
What is the deadly diamond of death in multiple inheritance?
It’s an issue where a class inherits from two classes that both inherit from the same base class, leading to ambiguity in method resolution.
How does Python prevent the deadly diamond of death in multiple inheritance scenarios
Python uses the C3 linearization algorithm (MRO) to ensure a consistent method resolution order