Lecture 2: Arrays Flashcards

1
Q

TH 4 steps of compiling source code into machine code

A

1-preprocessing

2-compiling

3-assembling

4-linking

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

What is Preprocessing?

A

It looks for header files we include such as , since it contains content, like prototypes of functions that we want to include in our program

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

What is compiling?

A

ittakes our source code, in C, and converts it to another language calledassembly language

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

What is assembling?

A

it takes the code in assembly and translate it to binary or machine code byassemblingit

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

What is linking?

A

linking is the process of combining all the machine code into our one binary file

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

The size of each different type of data

A
  • bool, 1 byte
  • char, 1 byte
  • float, 4 bytes
  • int, 4 bytes
  • double, 8 bytes
  • long, 8 bytes
  • string, ? bytes, it takes up a variable amount of space since it could be short or long.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what does an array do as a data type?

A

it describes multiple variables with one name. so we can store values of the same type, back-to-back, or contiguously.

Stack over flow: an array type is a data type that is meant to describe a collection of elements (values or variables), each selected by one or more indices that can be computed at run time

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

What are strings?

A

strings are just arrays of characters terminated with a null character \0

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

Why we need the Null character or \0?

A

Because it helps our program to know where the string ends. Since strings had no fixed size in memory

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

What are command-line arguments and what do they do?

A

Command-line arguments are simply arguments that are set after the name of the program
and they simply used when we tend to ask the user for input and there’s no size specified because we don’t know how big that will be

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

What does main function return?

A

it returns an integer value called anexit status which is 0 to indicate that nothing went wrong and our code has run successfully.

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

What happens when we write:
return 1;
and why do we write it at all?

A

we called a non-zero exit status which is a kind of “Handmade” error message written by the programmer itself to tell the user that they did something wrong which caused the program to exit early

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

What are the stages of Cryptography or what do we need to build its system?

A
  • Plaintext: the original message, or input
  • Key: additional number with the input
  • Cipher: the algorithm that does the scrambling
  • Ciphertext: the encrypted message, or output
How well did you know this?
1
Not at all
2
3
4
5
Perfectly