CS50 Week 1 Shorts Flashcards
Who were boolean values named after?
George Boole
What are the two possible conditions of a boolean value?
True and False
What are the boolean operators in C?
And &&
Or ||
Not !
what are the possible permutations of an AND expression?
TRUE and TRUE = TRUE
TRUE and FALSE = FALSE
FALSE and TRUE = FALSE
FALSE and FALSE = FALSE
What are the possible permutations of an OR expression?
TRUE and TRUE = TRUE
TRUE and FALSE = TRUE
FALSE and TRUE = TRUE
FALSE and FALSE = FALSE
What doe the NOT operator do?
It takes a boolean operator and returns the opposite of it.
What are the numerical representations of TRUE and FALSE in C?
0 = FALSE
Everything else = TRUE
What are the four major steps of the clang compiler?
1) Pre-processing, done by the pre-processor.
2) Compiling, done by the compiler.
3) Assembly, done by the assembler.
3) Linking, done by the linker.
What does the pre-processor do?
It recognizes pre-processor directives like #include and #define.
Libraries that are #included are appended to the top of the source code.
Constants that are #defined are replaced with their respective values.
What is the clang command to only run the pre-processor?
-E
What is the clang command to send your output to a new file?
> filename.c
What is done during the compiling portion of the compilation process?
The source code is converted to assembly code.
This is called compiling into assembly code.
What is the clang command to only run through the compilation step?
-S
What happens during the assembly portion of compilation?
The assembly code is converted into “object code,” or “machine code”.
What is machine code?
The actual 1’s and 0’s that the computer can read.
Why is the same source code compiled into different assembly code on different computers?
The assembly code is processor specific.
What is the clang command to only go through the assembly phase of compilation?
-c
What happens during the linking phase of the compilation process?
The linker combines together object code from different files into one file.
Why is it a good idea to run clang on every file?
Because linking can be very system specific.
What must be contained in at least one of the object files?
a main() function.
What is the clang command to link a file into the finished file?
- l + the file name.
- lname
Where do -l arguments go?
The end of the clang command.
Where do -l arguments go?
The end of the clang command.
What are three other terms for functions?
procedures, sub-routines, and sub-programs
What is the term for the organizational benefit of functions?
encapsulation
What are the inputs to a function called?
Arguments, or parameters.
Must a function take an argument, or return something?
No to both