Language History/Facts
C Basics
Strings, arrays, structs
Memory concepts
C Pointers and Memory
100

What language is more abstract than machine language, but less abstract than a high level language?

Assembly language

100

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.

100

What are strings terminated with?

The NUL byte

100

Where are local variables stored?

On the stack

100

What operator is used to dereference a pointer?

*

200

What language paradigm is C?

Imperative

200

What control flow keyword is used to go to the next iteration of a loop?

continue
200

What operator do we use to access a data member of a struct?

Dot operator (.)

200

What memory segment stores uninitialized global variables?

BSS

200

What operator is used to get the address of a variable?

&

300

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.

300

Free space

heheheha

300

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.

300

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.

300

Are pointers passed into functions by reference or by value?

By value
400

What are 4 compilation flags that we use with gcc?

-Wall -Wextra -pedantic -std=c99

400

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)

400

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.

400

What are the three goals of the operating system?

Protect processes from accessing other data, abstract detail of underlying hardware, manage resources among processes

400

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.

500

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.

500

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.

500

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.

500

What is the difference between memory segmentation and paging?

Memory segmentation makes contiguous virtual memory contiguous in the physical memory as well by using a base and bound. Paging splits physical memory into pages and can be accessed by using the page table to access the memory location physically.
500

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*