What language is more abstract than machine language, but less abstract than a high level language?
Assembly language
What is the difference between x++ and ++x?
x++ is post increment so it will evaluate to x and then perform the increment. ++x is pre increment so it will perform the increment before evaluating to x.
What are strings terminated with?
The NUL byte
Where are local variables stored?
On the stack
What operator is used to dereference a pointer?
*
What language paradigm is C?
Imperative
What control flow keyword is used to go to the next iteration of a loop?
What operator do we use to access a data member of a struct?
Dot operator (.)
What memory segment stores uninitialized global variables?
BSS
What operator is used to get the address of a variable?
&
What makes a programming language imperative?
The program state can be changed by the program itself, and consists of instructions in the program that allow this to happen.
Free space
heheheha
Why can a string be represented as both an array or pointer?
A string is an array of characters, and a character pointer points to the first element in a character array.
What is the difference between the stack and the heap?
The stack is automatically managed for you, but the heap contains dynamic memory that the programmer has to manage.
Are pointers passed into functions by reference or by value?
What are 4 compilation flags that we use with gcc?
-Wall -Wextra -pedantic -std=c99
What is the difference between operator precedence and associativity?
Operator precedence is the order in which different operators are evaluated on one line. Associativity is the order in which the operators with the same precedence on a line are evaluated (left to right or right to left)
What are two differences between structs and classes (in an OO language)?
Structs don't have functionality while classes do. Structs also don't support inheritance.
What are the three goals of the operating system?
Protect processes from accessing other data, abstract detail of underlying hardware, manage resources among processes
What does it mean to add or subtract an integer from a pointer?
It means that the pointer gets moved equal to the integer multiplied by the number of bytes of the data type that the pointer points to.
What is a header file used for?
Header files are used to specify the declaration of functions but not the definition (the actual implementation) and constant variables, among others.
What does the word static mean in the context of both global and local variables?
Static global variables are local to the file that they are contained in. Static local variables persist outside of a function so their value will be maintained.
Can we specify an empty array without a length (such as int arr[];)? Why or why not?
No; the length of an array must be specified if it is not being initialized in the same line. This is because it would otherwise not have any elements to initialize which would not be valid.
What is the difference between memory segmentation and paging?
Why does it matter that we give pointers a type? How do we create a generic pointer?
We give pointers a type so that when we dereference the pointer, we know how to interpret that data and know how many bytes we should read. A generic pointer can be created with void*