Chapter 1 - Part 1 Flashcards
What does the preprocessor do in C and what does it output?
The preprocessor modifies the original C program and outputs ASCII text.
What does the assembler stage do in a C program, and what does it output.
The assembler stage translates the assembly code into machine language instructions. It is output in a binary format, called a relocatable object program.
What does the compilation stage do in a C program, and what format does it output?
The compilation stage converts the C code into assembly language and outputs the generated code as text (usually with a .s extension).
What does the linking stage do in a C program?
Linking merges other object files referenced by the C program, and outputs an executable file (in machine language binary), which is ready to be loaded into memory.
How do you convert hex to binary using the bc command line tool?
echo ‘obase=2;ibase=16; A’ | bc
First stage of C compilation + clang command
Preprocesser: clang -E hello.c > hello.i
Second stage of C compilation + clang command
Compiler: clang -S hello.c
$ hello.s
Third stage of C compilation + clang command
Assembler: clang -c hello.c
$ hello.o
Fourth stage of C compilation + clang command
Linker: clang hello.c
$ a.out
How large is a word?
Words refer to a fixed size of bytes, but have no fixed size. Most modern machines use either 4 bytes (32 bits) or 8 bytes (64 bits).
Name 4 standard I/O devices.
Keyboard, mouse, display, disk.
For I/O devices, what’s the difference between a controller and an adapter.
A controller is soldered into the motherboard, an adapter plugs into motherboard slot.
What does DRAM stand for?
Dynamic random access memory.
What is a word-sized storage device in the CPU called?
register
What is the program counter in a CPU.
The program counter contains the address of a register holding the next machine language instruction it will execute.