Data and Program Representation Flashcards

1
Q

Memory contains address from ___ to ___ for 32 bit architecture.

A

0, 2^32 - 1 // 0 to 4GB -1

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

Memory sections:

Text is for ___.

A

Instructions that the program runs

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

Memory sections:

Data is for ___.

A

Initialized global variables

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

Memory sections:

Rodata is for ___.

A

Read Only Data. String constants

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

Memory sections:

Bss is for ___.

A

Uninitialized global variables. They are initialized to 0

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

Memory sections:

Heap is for ___.

A

Storing the memory returned when calling malloc/new

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

Memory sections:

Stack is for ___.

A

Storing local variables and return addresses

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

Heap grows __, stack grows __.

A

upwards; downwards

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

There will never be gaps that do not have any memory mapping.
True/False

A

False.

SEGV Signal if occurs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A program includes \_\_\_. (5 items):-
Machine \_\_\_\_
Initialized \_\_\_
Library \_\_\_\_
Memory \_\_\_ that the program will use
Undefined \_\_\_ in the executable that will be known until the program is loaded into memory
A

instruction, data, dependencies, sections, values

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

File formats:

ELF = ?

A

Executable Link File

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

File formats:

COFF = ?

A

Common Object File Format

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

Match the file formats to their descriptions (ELF, COFF, a.out).

  • Used in most UNIX systems
  • Used in early UNIX; very restrictive
  • Used in Windows Systems
A

ELF, a.out, COFF

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

1: After a program is written, the preprocessor expands ____ and generates ____ file.

A

preprocessor statements, .i

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

2: The compiler compiles .i file, ____ it and generates an ____ listing __ file.

A

optimizes, assembly instruction, .s

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

3: The assembler ___ .s file and generates an ___ file.

A

assembles, .o

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

4: The ___ put together all .o files and the .o files in ____ libraries.

A

linker, shared

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

The linker verifies the ___ needed by the program are satisfied, if not, ___.

A

symbols, error occurs

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

____ (.a files) are added to the executable, ___ (.so files) are not added to the executable files.

A

static libraries, shared libraries

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

Loader is a program used to run an ___ file in a process.

A

executable

21
Q

Before running, a loader ______.

A

allocate spaces for all the memory sections of the executable file

22
Q

If not loaded yet, a loader loads ___ and ___ into memory.

A

the executable, shared libraries

23
Q

Once memory image is ready, the loader jumps to the ___ entry point that calls ___ of all libraries and ___ static instructors.

A

_start; init(); initializes

24
Q

_start also calls ___ when main() returns.

25
Loader is also called ___ or ___.
runtime linker; dynamic linker
26
___ are shared across different processes, while ___ are not shared.
Shared libraries; static libraries
27
Pointer is a variable that contains an ___ in memory.
address
28
In 32-bits architecture, pointer is ___ bytes; 64-bits architecture, pointer is ___ bytes.
4; 8
29
It does not matter if the pointer is pointing to a valid memory before assigning or getting any value from the location. True/False
False. Pointer must point to valid memory.
30
Strdup() is the only string function that allocates memory. | True/False
True
31
String is a sequence of characters in ASCII terminated by a ___.
'\0'
32
a[i] = ?
* ((int*) (char)&a[0] + i*sizeof(int)))
33
int **a is a valid 2D array implementation. | Initialize a with malloc sizeof (int*), then for each row, initialize each row with sizeof(int).
True
34
Pointer to functions are used to implement ___.
Polymorphism
35
Bit stores __ or __.
1, 0
36
Byte is a group of __ bits that can be individually addressable.
8
37
Word is __ bytes (32-bits architecture) / __ bytes (64-bits architecture).
4, 8
38
EBCDIC = ?
Extended Binary Coded Decimal Interchange Format
39
ASCII = ?
American Standard Code for Information Exchange
40
Match each description with their character encodings (EBCDIC, ASCII, UNICODE). - Only encodes the English alphabet; 7 bits - Java and C#; represents characters from most languages; 16 bits long - Created by IBM
ASCII UNICODE EBCDIC
41
In using sign and magnitude to represent negative integer number, __ bit for sign, other bits for ____.
1; absolute value
42
In 1-Complement, negative integers are represented by ___.
Inverting all bits
43
In 2-complement, we ___ from positive number and ___ the result.
subtract 1; invert
44
2-complement is widely used because ___.
The same piece of hardware used for positive numbers can be used for negative numbers
45
In floating point representation, the exponent is calculated by ___.
exponent - bias
46
Little endian - ____ significant byte at the lowest memory location. Big endian - ____ significant byte at the lowest memory location.
least; most
47
Structure is a combination in memory of ___.
primitive types
48
In alignment for structures (32-bit architecture), integers, float, and pointers have to be aligned to ___ bytes.
4
49
If the types are not aligned in structure ___ or ___ will occur.
Bus error; slow down execution