The Basics of Programming and Software Flashcards
programming, algos, data struct, engineering
what is machine language / machine code
computer hardware can only understand raw binary instructions of electronic signals.
no signal = 0 or false
a signal = 1 or true
what is a compiler?
a program that transforms high-level programming language (Java, C, C++, C#) written by a programmer, into machine level language ( 1s and 0s) so the CPU/hardware can understand and execute the program.
The main job of the compiler is that it checks all kinds of limits, ranges, errors, etc. Before the compiler can successfully execute the code, the errors must be removed from the source code.
The output of compiler is a mnemonic version of machine code.
what is an assembler?
a program that converts the assembly code (text-based) into machine code (binary).
The output of assembler is binary code.
The translation is mechanical, and can be done in only one way. Meaning that given an assembly code 𝐴, there is a single translation 𝑇(𝐴) of 𝐴 into machine code.
what is a code fix called a patch?
old computers used punch paper tape full of holes and they fixed the program by putting tape over holes.
what is an assembly language?
a low-level text-based language which uses mnemonics/opscode to represent each machine binary code.
it has direct 1:1 mapping to machine instructions. And has to deal with fetching data from specific memory address, etc.
where did the term loop come from in programming
Old computers had their programs written on punch paper tape full of holes.
To make the computer repeat the program, they used tape to tape the two ends of the punch paper together and it formed a loop of paper tape.
why were high-level programs created?
it was painful for humans to write programs in binary (1s and 0s) which only CPU hardware can understand.
And assembly language / machine code often only works on specific computers, not all types of computers.
So they built high-level programming languages so it was easier and faster for humans to write programs.
why was assembly language created?
people got sick of writing programs in 1s and 0s / binary / machine code.
LOAD_A is easier to understand, write and read for humans than 00101110.
Why was COBOL created?
Because early FORTRAN programs at the time could only run on a specific type of computer. So programs had to be rewritten when new computer hardware was created.
COBOL programming language was created to be used strictly for business and made to be portable so it can be run on different types of computers.
What does COBOL stand for?
common business-oriented language
What are the limits of assembly language / machine code?
it’s CPU specific. So progs written in it, often only worked on a specific computer.
what is the selection sort algorithm?
an algorithm for sorting values in an array.
n^2
- it looks at each item in the array and finds the smallest number
- It moves the smallest number to the top.
- Repeats those operations on the rest of the numbers
What is Big O Notation
A theoretical measure of the execution of an algorithm, usually the time or memory needed, given the problem size n, which is usually the number of items.
Used to determine how slow a sorting algo exponentially grows as the number of items that need to be sorted increases.
what is the merge sort algorithm?
an algorithm for sorting values in an array.
n*log n
- splits the array into arrays of 1 item in each
- compares 2 arrays to find the smallest value
- merges the 2 arrays into 1 sorted array
- repeats for the rest of the paired arrays.
what dijkstra’s algorithm? And what is it used for?
An algorithm for finding the shortest paths between nodes in a graph.
It assigns a number value to nodes and the routes between them and calculates the shortest path.