1/35
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Instruction Set Architecture (ISA)
models how software controls the CPU and sets instructions for the software-to-hardware interface. It defines instructions for data types, registers, and hardware memory management.
primary components of a computer
Input/Output, Battery, Memory, Hard Drive, CPU, and GPU.
Von Neumann Model
It is a programming reference model where programs and instructions are stored in the same memory, treating instructions as data.
High-level language
Human-readable, needs a compiler, versatile but slower.
Assembly language
Human-readable machine code, needs conversion to binary.
Machine language
Binary code, closest to hardware, fastest execution time.
Moore's Law?
states that the number of transistors or components in a chip will double each year, leading to increased power consumption and the need for miniaturization.
Amdahl's Law
describes the maximum improvement possible when only a portion of a program can be optimized, factoring in the speedup of that part and its usage percentage.
main factors to consider in computer operation?
Memory, power, and processing, which determine how much memory/space is needed, how long a program runs, and how fast or efficient it is.
Amdahl’s law formula
How many buses does the von numean model has and why
single pathway (bus) for both instructions (commands) and data to travel between the CPU (Central Processing Unit) and memory.
What is a pointer in C?
A pointer is a variable that contains the memory address of another variable. It is declared with the *
symbol.
What is the difference between stack and heap memory in C?
Stack memory is used for temporary, local variables and is automatically deallocated after the function call. Heap memory is manually allocated using malloc()
and must be manually deallocated with free()
.
What is a structure in C?
A structure in C is a user-defined data type that allows grouping variables of different types under a single name.
How is memory dynamically allocated in C?
Memory is dynamically allocated in C using the malloc()
function, which returns a pointer to the allocated space.
What is the free()
function in C used for?
The function is used to deallocate memory that was previously allocated by malloc()
to avoid memory leaks.
What is the difference between high-level, assembly, and machine languages?
High-level languages (e.g., C, Python) are human-readable and require a compiler. Assembly languages are closer to machine code but still readable. Machine languages are binary instructions executed directly by the CPU.
How do linked lists differ from arrays?
Arrays store elements in contiguous memory blocks and have fixed size, while linked lists store elements in different memory locations and are dynamically allocated.
What are the key characteristics of a circular linked list?
In a circular linked list, the last node points back to the first node, forming a loop.
What are file input functions in C?
fopen()
to open a file, fscanf()
to read from a file, fprintf()
to write to a file, and fclose()
to close a file.
What is Amdahl's Law?
states that the overall performance improvement gained by enhancing a portion of a system is limited by the fraction of time the enhancement is actually used.
What is a doubly linked list?
a data structure where each node contains pointers to both the next and previous nodes, allowing traversal in both directions.
How is a 2D array declared in C?
declared using two sets of brackets, e.g., int arr[3][4]
, which creates an array with 3 rows and 4 columns.
What are the benefits of linked lists over arrays?
Linked lists provide dynamic memory allocation and are more efficient for insertions and deletions compared to arrays, which have static memory allocation.
What is the purpose of a Makefile in C?
automates the build process by specifying how to compile and link the program, typically using the gcc
compiler.
What does the gcc
flag -Wall
do?
The -Wall
flag in gcc
enables all compiler warnings, helping developers identify potential issues.
What does the gcc
flag -Werror
do?
The -Werror
flag in gcc
treats all warnings as errors, stopping the compilation if any warnings are present.
What is the use of the *
operator in C?
operator is used to declare pointers and dereference them, i.e., to access the value stored at a memory address.
What is the purpose of the &
operator in C?
operator is used to retrieve the address of a variable in C.
What happens if memory allocated with malloc()
is not freed?
leads to a memory leak, consuming unnecessary system memory.
What is a 2D array in C?
can be visualized as a matrix with rows and columns, declared as int arr[rows][cols];
How do you open a file for reading in C?
use the fopen()
function with the "r"
mode, e.g., fopen("file.txt", "r");
.
What is the ->
operator used for in C?
operator is used to access members of a structure through a pointer.
What is the . operator
used for in C?
used to access members of a structure directly, without using a pointer.
How do you initialize a structure in C?
struct student s1 = {101, "John", 3.5};
Amdahl’s law formula
S = 1/((1-P) + (P/S_p))