Exam prep Flashcards
What is a bit?
Smallest bit of information. It’s a zero or a one.
What is a byte?
8 bits. Those 8 bits are contiguous
What is a word?
A set of bits. most common being 8, 16, 32 and 64. You can pass a word to the cpu for processing.
What is fragmentation?
Storage space used in an inefficient way
What is a bus error?
When the memory is accessed by words but stored as bytes.
when your processor cannot even attempt the memory access requested
What is main memory?
This is your random access memory. Very fast memory that the cpu uses to temporarily store data.
What is secondary memory?
This is your HDD or SSD. Long term storage. A little slow. Keeps information even after computer is switched off.
What are I/O units
Peripherals used by humans to interact with the computer. Ie keyboard, mouse ect
What is cached memory?
memory that is stored on the cpu chip or very close by on the motherboard. Very fast.
What is a stack overflow? What may cause it?
A stack overflow is a run-time software bug when a program attempts to use more space than is available on the run-time stack
What is the order hierarchy of software?
from bottom to top : Code, Data, Heap, Stack.
(Hierarchy) What is code?
Where the compiled code resides. Usually read only.
(Hierarchy) What is Data?
Where variables that are accessible to everything (ie global variables) reside.
(Hierarchy) What is the stack? which way does it grow ?
The stack grows down. When we run our programs, the grow down on the stack.
. The stack is an area that typically has a predetermined size
. An example of allocating a variable to the stack would be : int a = 5;
stores temporary variables created by a function. In stack, variables are declared, stored and initialized during runtime.
Stores activation records
It is a temporary storage memory. When the computing task is complete, the memory of the variable will be automatically erased. The stack section mostly contains methods, local variable, and reference variables.
(Hierarchy) What is the heap? Which way does it grow?
The heap grows up. When we dynamically allocate data this will grow up in the heap.
. The heap is also predetermined but can grow.
. the new keyword is used to allocate something to the heap.
int *hval = new int; This is dynamically allocating a pointer onto the heap that points to a
int.
*hval = 5; To give it a value you need to dereference the pointer.
how many bytes is an int?
4 bytes
Declare an int variable a on the stack equal to 5.
int a = 5;
declare an int variable b on the heap qual to 5.
int* b = new int;
*b = 5;