CS50: Weeks 0-5 Flashcards
What does “BIT” stand for?
BInary digiT
What does “ASCII” stand for?
American Standard Code for Information Interchange
What is an algorithm?
A set of instructions for the computer to follow.
What is pseudocode?
English “code” to represent algorithm steps.
What does CS, or the science of computation, consist of?
Inputs, algorithms, and outputs.
What is binary?
A number scale in base-2 (0,1) - 2^0 [1], 2^1 [2], 2^2 [4], 2^3 [8] …
What is an API?
Application Programming Interface
Who created ALTAIR Basic, and when?
Bill Gates, Paul Allen in 1975.
When was the BASIC language created and where?
1964 at Darmouth College
Who created the C language, and where/when?
Dennis Ritchie at AT&T Bell Labs between 1969-1973
What is a “library”?
Pre-written source code that can be “included” into other source files to use its functions.
What is a “function”?
A subroutine that performs one or many actions.
What is the standard output function in C?
printf()
What is the condition function in C?
if() {}
What are the loop functions in C?
while() {}, for() {}, and do {} while()
What is the “new line” character in C?
“\n”
How do you declare a variable in C?
= ; e.g., “string firstName = “Bryan”;
Who approved ASCII and when?
ANSI (American National Standards Institute) in 1963.
What are the first 128 characters of the ASCII set?
0-31 = control characters (0=NULL or “\0”, termination character)
32-126 = printable characters (letters, numbers, punctuation, special)
Digits 0-9 are represented by ASCII 48-57, which when translated to binary include the binary equivalent of 0-9 prefixed by 011.
127 = DEL(ETE)
Explain the binary search algorithm and how it is calculated.
Binary search is a log base 2 (log2) sequence.
· e.g., log n calculation: 2^7 = 128, so log2(128) = 7
What are 3 reasons to use functions?
Organization, Simplification, Reusability
What is “argv[]”?
argv[] is a dynamically created char* (string) array holding command line arguments.
What are some examples of simple but inefficient sorting algorithms?
Bubble, Selection, Insertion sorts.
What is the “core” file that sometimes exist in a program’s running directory?
A core (file) is the snapshot of the program’s memory when a error causes a “core dump”.
How does a Bubble sort work?
Start at beginning; compare two numbers at a time and swap to be in order.
How does a Selection sort work?
Find smallest element in entire set and move it to the beginning, swapping with that existing position. Then next lowest value, etc.