Programming Basics Flashcards

1
Q

Binary

A

Machine code in 1s and 0s

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

Programming Languages

A

A middle man to translate computer machine code into a digestable language

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

Low-level vs. high-level programming languages

A

Low level: C, Assembly (closer to binary code)
High level: Java Python

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

IDE’s (Integrated Development Environments)

A

We use IDE’s to write code. A place to write, run, and debug code and also convert it to machine code (visual studio code. NetBeans, IntelliJ)

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

Syntax

A

All programming languages have a set of rules you must follow, at the forefront of those rules is grammar. Grammar in programming = syntax. In order to run smoothly, Syntax for each language must be correct.

Each language must be unique in its Syntax.

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

Print Statement

A

This is console.log, the output of the code

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

Modulus

A

Represented with % - allows us to get the remainder of a divisional operation
Done to see if the answer is even or odd

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

Strings

A

Another way to say text
Anything enclosed by quotation marks is a string

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

Concatenation

A

Adding strings together

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

Integer vs. String

A

4 in quotation marks (“4”) is treated as a STRING
4 without quotation marks (4) is treated as an INTEGER

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

Variable

A

Something that can store information and be referenced and manipulated.

Each variable has a type, name, and a piece of information stored inside of it.

One of the most important concepts in programming is variables. A variable points to a specific memory address that stores a value. Variables are given a name which can be used throughout your code to access that value.

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

Primitive Variables

A

Integers, Booleans, Floats, doubles, strings and Chars

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

Integer Variables

A

A variable that can store an Integer value,
Only whole values, it can and will not hold any decimal values

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

Boolean Variables

A

True or false
Used in conditional Statements

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

Float Variables

A

Can store up to 32 bits of information (in decimals)

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

Double Variables

A

Can store up to 64 bits of information (in decimals)

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

String Variables

A

Text stored in a readable format for the user

18
Q

Char Variable

A

Stands for character
Can each hold one character
Useful when a programmer wants to read one button press of one character in a string without using a String variable (think keyboard)

19
Q

Limitations of Variables

A

Integer, Float and double variables can be:
- added
-subtracted
- Multiplied
- Divided
- Modulused

String Variables can be:
-added

Char’s and Booleans’s:
Can’t be operated on

20
Q

Conditional Statements (IF Statement)

A

If some condition is true, then carry out the instructions located within the IF statements brackets. ELSE do the other thing.

21
Q

Conditional Statements + brackets

A

Most programming languages use braces/brackets () {}

Whatever is inside the braces will be evaluated as either true or false

If the statement is true, whatever is enclosed inside a set of curly braces directly after the if statement will run

If the information in the bracket is not true, then none of the code will run

22
Q

Else-IF and Else

A

The else-if statement will only be evaluated if the preceding if (or if-else) statement was bypassed due to it being false

23
Q

Switch Statement

A

Functionally similar to many else-if statements together

Start with a colon
Each switch statement also includes a default case (else statement)

24
Q

Conditional Statements

A

Adds variablitly to programming - program runs differently based on user input

if a user does something we want to adapt accordingly

A program without conditional statements would run the same thing every time - really primitive

25
Q

Array’s

A

Is a list. You can have a list of integers, strings, and even other arrays.
All information in an array is related.

Solves the limitations of Variables.

26
Q

Variable Limitations

A

Variables are very good at storing singular bits of information, as a result they are UNABLE TO HOLD MORE THAN ONE PIECE OF DATA.

27
Q

Refrencing Arrays

A

We use indexes, indexes start with 0

28
Q

Creating Arrays

A

Populate first:
Insert the elements you would like in the array immediately

Populate Later:
Create an array with a specific size, but choose to add elements later

NOTE: Once an array is defined, you can not change its size through conventional methods.

Note: When initializing an array you must determine its type then and there. They all have to be the same type.
ex: String array, integer array, double array, etc.

29
Q

Loops

A

Statement that is used to run certain instructions repeatedly
Very useful for repeated code

Benefits:
Perform operations many times in a row
able to iterate through arrays and lists
decrease clutter of your code

30
Q

For Loop

A

Used when you would like to carry out a certain set of instructions numerous times

Consists of 3 parts (depends on language syntax):
- Integer value
- Conditional statement that the integer must reach to exit the loop
- An operation to modify the integer value after the instructions inside of the loop are completed

NOTE: YOU LOOP MUST TERMINATE

31
Q

For Each Loop

A

Used for iterating through entire arrays and lists
The loop will go through each element in the array and carry out a set of instructions for each value
Useful for performing operations across an entire collection of data

32
Q

While Loop

A

While loop will continually carry out its instructions while a conditional statement given to it is true
Similar to a for loop, but broken apart
Can sometimes be used to purposely create an infinite loop

33
Q

Syntax Error

A

Parts in your program where you failt ot meet the programming rules, resulting in an error

Should be caught in the IDE

34
Q

Runtime Error

A

These errors don’t show until you actually run the code, for example a loop that does not stop, will crash the computer or program since it can’t complete the code

35
Q

Logic Error

A

The code runs smoothly without runtime or syntax errors, but the result isn’t what you wanted
Often the hardest type of errors to solve- most of the time, the error is unknown to the programmer

The code is working, but it just doesn’t work as it’s intended.

36
Q

3 Types of Errors

A

Syntax
Runtime
Logic

37
Q

Function

A

A segment of code that can be easily run by calling the function name
depending on the type of function may do something in return

Can be called numerous times, and in numerous places

Like wrapping code into a present and giving it a name

38
Q

Types of Functions

A

4 Types
Separated by whether or not they take in arguments
Separated by whether or not they return values

39
Q

Argument: Functions

A

Variables we pass into a function in order to be manipulated and then either…
Returned back to us
Printed to the console
Used in another operation

A way for programmers to have one function that can do many different things
Add variability to programming
Helps diversity your code

40
Q

Declaring a Variable

A

Declaring a variable means giving it a name.