L1- C Flashcards

1
Q

Source code

A

What humans write in a high-level language.

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

Machine code

A

Binary, which computers understand, which is a low-level language

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

Compiler

A

A program that translates one language to another language. For this example, it’s converting c to machine language

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

Terminal window/console

A

Command line interface where you only use your keyboard

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

GUI -(gooey)

A

Graphical user interface which are the buttons and things that you click on

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

code

What does this command line program for this CS50 class do?

A

Open/create a new file to write
Usage: code filename. fileExt
code hello.c

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

make
What does this command line program for this CS50 class do?

A

Compiles the file
Usage: make filename
make hello.c

Creates the executable without the ext
hello

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

Command: ./

A

Runs the executable
Usage: ./Executable filename
./hello

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

Command line: $

A

Represents the prompt in the terminal window

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

Command line: .

A

Current folder?

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

Command line: ..

A

Parent folder (up one folder)

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

Escape sequence

A

specially delimited text in a character or string literal that represents one or more other characters to the compiler. It allows a programmer to specify characters that are otherwise difficult or impossible to specify in a literal.

An escape sequence starts with a backslash () called the escape character and subsequent characters define the meaning of the escape sequence. For example, \n denotes a newline character.

The same or similar escape sequences are used in other, related languages such C, C++, C#, Java and PHP

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

Libraries

A

Code someone else wrote that needs to be included to use the functions within the file.
Ex: #include <stdio.h>
Standard io.h - input/output for C</stdio.h>

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

.h file

A

Header file that gives you access to the libraries (functions)
stdio.h

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

String

A

Text
“This is a string.”

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

Int

A

Integer
32 bit Real #
123
~4 billion positive # or ~2 billion negative

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

Float

A

Floating point
32 bit Decimal
1.23
~4 billion positive # or ~2 billion negative

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

Char

A

Character
Exactly one uppercase letter
‘A’

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

Long

A

Integer
64 bit Real #
123
More than 4 billion positive/2 billion with negative

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

Double

A

64 bit Decimal (Floating point)
1.23
More than 4 billion positive/2 billion with negative

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

Clear command line

A

Ctrl+l

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

Dissect:
compiler error: hello.c:5:7:error use of undeclared identifier

A

hello.c - file with the error
5 - line number
7 - character
error use of undeclared identifier - message that usually means your variable isn’t defined before it is being used

23
Q

Format codes to print variables in C
printf(“text to print,__\n”, variable)
String

A

%s

24
Q

Format codes to print variables in C
printf(“text to print,__\n”, variable)
char

A

%c

25
Q

Format codes to print variables in C
printf(“text to print,__\n”, variable)
Float

A

%f

26
Q

Format codes to print variables in C
printf(“text to print,__\n”, variable)
double

A

%f

27
Q

Format codes to print variables in C
printf(“text to print,__\n”, variable)
int

A

%i

28
Q

Format codes to print variables in C
printf(“text to print,__\n”, variable)
long

A

%li

29
Q

Flowchart: Oval

A

Terminator( start/ stop)

30
Q

Flowchart: rectangle

A

Processes (tasks/actions)

31
Q

Flowchart: diamond

A

Decisions (binary choices)

32
Q

while loop

A

Checks for a condition to be true, then loops until it’s false

while(){

}

33
Q

do while loop

A

Performs the action once, then checks for a condition to be true, and loops until it’s false

do{

}while()

34
Q

for loop

A

Initializes and declares a variable, then perform the action until the expression is true. After performing the action, variable is incremented, then expression is checked again and continues until the expression is true.

for (int i = 0; i<3; i++){

}

35
Q

Function prototype

A

Return value. function name. arguments.
void meow()
void bark(int i)

Void returns nothing

Return value. function name. parenthesis. arguments.

36
Q

Scope

A

Context and which variables exist.
Local only exists within the curly brackets immediately surrounding it
Global exist and is accessible through entire page

37
Q

CLI

A

Another name for command line interface

38
Q

Command line: cd

A

Change directory
cd directory path

39
Q

Command line: cp

A

Copy
cp * file to copy* * new file name*

40
Q

Command line: up arrow

A

Toggles through previous commands

41
Q

Command line: ls

A

List
Shows all files in the current folder

42
Q

Command line: mkdir

A

Make directory
mkdir * New folder name*

43
Q

Command line: ./* Partial file name*

A

Will auto complete a name if it exists

44
Q

Command line: mv

A

Move, which is actually rename
mv * original file* * New file name*

45
Q

Command line: rm

A

Remove file /delete
rm * file name*

Confirm with y/n

46
Q

Command line: rmdir

A

Remove directory deletes

47
Q

Magic number

A

A unique value with unexplained meaning or multiple occurrences which could (preferably) be replaced with a named constant

48
Q

Constant

A

A variable that cannot be changed while the program is running

49
Q

RAM

A

Random access memory- all data in computer is stored here

50
Q

Integer overflow

A

When you don’t have enough memory, the numbers will wrap around and could be mistaken for zero or negative numbers incorrectly

Ex: Three bits can only count to seven as 111, then when going to 8, it would be 1000. Since there’s only three bits, all you would see would be 000 and would not be correct or as expected

51
Q

Truncation

A

When parts of data is cut off.
Example: when dividing an integer by an integer, the fraction gets thrown away, so you would not be able to display the fractional piece as is without changing the data type or casting

52
Q

Type cast

A

Converting a data type to another data type
Exam for trying to divide integers would need tight casting to display the fractional part
int x, y;
float z=(float) x/(float) y;

53
Q

How to set the number of decimal places for a float value

A

%.6f
This shows exactly six decimal places

54
Q

Floating point imprecision

A

Since there are a finite number of bytes it is impossible to show all values in a floating point number without some sort of rounding at some point.