Quiz 1

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/35

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

36 Terms

1
New cards

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.

2
New cards

primary components of a computer

Input/Output, Battery, Memory, Hard Drive, CPU, and GPU.

3
New cards
<p>Von Neumann Model</p>

Von Neumann Model

It is a programming reference model where programs and instructions are stored in the same memory, treating instructions as data.

4
New cards

High-level language

Human-readable, needs a compiler, versatile but slower.

5
New cards

Assembly language

Human-readable machine code, needs conversion to binary.

6
New cards

Machine language

Binary code, closest to hardware, fastest execution time.

7
New cards

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.

8
New cards

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.

9
New cards

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.

10
New cards

Amdahl’s law formula

<p></p>
11
New cards

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.

12
New cards

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.

13
New cards

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().

14
New cards

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.

15
New cards

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.

16
New cards

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.

17
New cards

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.

18
New cards

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.

19
New cards

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.

20
New cards

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.

21
New cards

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.

22
New cards

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.

23
New cards

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.

24
New cards

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.

25
New cards

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.

26
New cards

What does the gcc flag -Wall do?

The -Wall flag in gcc enables all compiler warnings, helping developers identify potential issues.

27
New cards

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.

28
New cards

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.

29
New cards

What is the purpose of the & operator in C?

operator is used to retrieve the address of a variable in C.

30
New cards

What happens if memory allocated with malloc() is not freed?

leads to a memory leak, consuming unnecessary system memory.

31
New cards

What is a 2D array in C?

can be visualized as a matrix with rows and columns, declared as int arr[rows][cols];

32
New cards

How do you open a file for reading in C?

use the fopen() function with the "r" mode, e.g., fopen("file.txt", "r");.

33
New cards

What is the -> operator used for in C?

operator is used to access members of a structure through a pointer.

34
New cards

What is the . operator used for in C?

used to access members of a structure directly, without using a pointer.

35
New cards

How do you initialize a structure in C?

struct student s1 = {101, "John", 3.5};

36
New cards

Amdahl’s law formula

S = 1/((1-P) + (P/S_p))