Lecture4: Memory Flashcards

1
Q

What are the differences between the Binary system and the Hexadecimal system?

A

The main difference is that Hexadecimal uses 16 digits to represent things such as text, colo…
instead of only 2 digits in Binary system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a pointer?

A

it is a variable that stores an address in memory, where some other variable might be stored (like an arrow that guides you to another area)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  • means
A
  • declares a variable as a pointer

- dereference operator, which goes to an address to get the value stored there

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what do s do as a data type?

A

it is a pointer with the address of the first character which will continuously read the array, character after character till hit \0 or the Null character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is the Pointer arithmetic?

A

it is the process of applying mathematical operations to pointers, using them just like numbers (which they are)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

malloc is a function which used to

A

allocate some number of bytes in memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

free is a function which used to

A

free memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are garbage values and when do they appear?

A

They are unknown values that were in memory, from whatever program was running on our computer before. and they appear when we have no specific values in our program

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The 4 sections of the Memory layout

A

1-machine code
2-globals
3-heap
4-stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What will happen in the machine code section?

A

here is where our compiler starts to translate source code into machine code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What will happen in the globals section?

A

here is where will our program read the global variables that we declared in our code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What will happen in the heap section?

A

here is an empty area from wheremalloccan get free memory for our program to use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What will happen in the stack section?

A

it is used by functions and local variables that we created in our program as they are called, and grows upwards.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

scanf is a function which used to

A

pass in the address in memory where we want a specific part from an input

How well did you know this?
1
Not at all
2
3
4
5
Perfectly