Math & Computer Science Flashcards
What is dependency injection?
Rather than a client object creating its own dependencies or services, they are supplied by someone else so that the client doesn’t need to know how to create the service
What are eigenvectors and eigenvalues?
Eigenvectors of a linear transformation (matrix) are not changed except in magnitude (the corresponding eigenvalue). They can form the basis vectors of a transformation
What is a multiplexer?
A logic gate that toggles between the value of 2 inputs depending on the selector
What does an ALU do? How is it made?
It can do many different calculations (AND, NOT, addition, negation, etc) on inputs depending on several other inputs that can be relatively elegantly designed
How can you create memory from NAND gates?
Build a flip-flop using a looped NAND gate
What is machine language?
Binary instructions to a computer corresponding to different ALU calculations and storage into registers and memory
What is assembly?
A human readable version of machine language e.g. D=A+1, @variable with labels
What are the 3 main components of a computer?
ROM (instructions), CPU, and Memory
What is an assembler?
Turns assembly into machine language, including converting various labels and variables
What does a Virtual Machine do?
Provides indirection between a high level language and assembly
How are Virtual Machines implemented?
Stack Machine
How are function calls represented in a VM?
All arguments are already on the stack. Add the return code address and other pointers. Reserve space for the local variables. Move the stack pointer and jump
How are methods and constructors different from regular function calls?
They also either allocate space or add a “this” reference
How are variables tracked in a compiler?
A linked list of Symbol tables that each go deeper into scope
What does an operating system take care of?
Memory management, device input, output, strings, arrays, math, initializing everything above