L1- C Flashcards

(54 cards)

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

24
Q

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

25
Format codes to print variables in C printf("text to print,**__**\n", variable) Float
%f
26
Format codes to print variables in C printf("text to print,**__**\n", variable) double
%f
27
Format codes to print variables in C printf("text to print,**__**\n", variable) int
%i
28
Format codes to print variables in C printf("text to print,**__**\n", variable) long
%li
29
Flowchart: Oval
Terminator( start/ stop)
30
Flowchart: rectangle
Processes (tasks/actions)
31
Flowchart: diamond
Decisions (binary choices)
32
while loop
Checks for a condition to be true, then loops until it's false while(){ ... }
33
do while loop
Performs the action once, then checks for a condition to be true, and loops until it's false do{ ... }while()
34
for loop
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
Function prototype
Return value. function name. arguments. void meow() void bark(int i) Void returns nothing Return value. function name. parenthesis. arguments.
36
Scope
Context and which variables exist. Local only exists within the curly brackets immediately surrounding it Global exist and is accessible through entire page
37
CLI
Another name for command line interface
38
Command line: cd
Change directory cd *directory path*
39
Command line: cp
Copy cp * file to copy* * new file name*
40
Command line: up arrow
Toggles through previous commands
41
Command line: ls
List Shows all files in the current folder
42
Command line: mkdir
Make directory mkdir * New folder name*
43
Command line: ./* Partial file name*
Will auto complete a name if it exists
44
Command line: mv
Move, which is actually rename mv * original file* * New file name*
45
Command line: rm
Remove file /delete rm * file name* Confirm with y/n
46
Command line: rmdir
Remove directory deletes
47
Magic number
A unique value with unexplained meaning or multiple occurrences which could (preferably) be replaced with a named constant
48
Constant
A variable that cannot be changed while the program is running
49
RAM
Random access memory- all data in computer is stored here
50
Integer overflow
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 **1**000. Since there's only three bits, all you would see would be 000 and would not be correct or as expected
51
Truncation
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
Type cast
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
How to set the number of decimal places for a float value
%.6f This shows exactly six decimal places
54
Floating point imprecision
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.