Intro Flashcards

(45 cards)

1
Q

What is an IDE (Integrated Development Enviorment)

A

A place to write, run, and debug code and convert it into machine code.

NetBeans, IntelliJ, Visual Studios.

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

What is Syntax

A

A set of rules you must follow when writing code in a language

It’s similar to grammar rules in real life languages

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

What is a Console

A

A text interface in a computer that can be used for a variety of purposes

Main use is for outputting text from the program using code.

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

Print statement

A

Prints text to the console for programmers to see

Print (“Hello World”)- python

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

Modulus

A

Represented with %

Allows us to get the remainder of a division problem. The console will oly show the remainder

Print(10 % 3)

Console: 1

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

What is a string

A

Anything enclosed by quotation marks is a string

“Hello World”
“A”

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

Concatenation

A

Adding two strings together

print( “Game over, “ + 4 + “ was your final score.”)

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

The 4 “4” Dilema

A

The 4 in quotation marks is a string

The 4 without quotation marks is an integer

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

What is a variable

A

Something that can store information
Can be referenced and manipulated

Think of it as a cardboard box

Each variable has a type, name, and a peice of information

Name is just a name for the variable

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

Integer

A

A variable that can store an integer value

Cannot hold decimal values

-2,147,483,648 to 2,147,483,648

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

Booleans

A

Can store a value of either true or false

Can only hold true or false

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

Float and double variables

A

Both can store numbers with decimal places

Float: can store up to 32 bits of info

Double: can store up to 64 bits of info

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

String variables

A

Just like strings, but can be stored in a variable

Used for displaying text and storing input information, outputting information in a readable format for the user

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

Char variables

A

Can only hold one character

“A”

Useful for reading one button press of one character in a string without a string variable. Like a game controlled by a keyboard

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

The use of variables

A

To keep track of things in code, such as a user’s name and score to reference and modify.

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

Naming variable big rule

A

They must be one continuous string

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

camelCase

A

The writing of code that doesn’t capitalize the first letter but capitalizing all words after. Makes it easier to read

camelCaseVariable

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

The if statement

A

The most basic conditional statement

If something is true, do one thing
If something isn’t true, do another thing

If (Thing is True) {do what ever is in here}

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

The Else-If statement

A

The statement that will only be evaluated if the preceding if statement was bypasses due to being false

20
Q

The else statement

A

The statement that comes after an if/if-else statement, and will always carry out instructions

Carried out if all previous cases are untrue

21
Q

The Switch statement

A

A collapsible way to write many if else statements

Imput a variable, then determine what “cases” that variable could be

Switch (Var)

22
Q

Why are conditional statements useful

A

Adds variability to your code/ program runs differently based on user input

The program will want to adapt to user input accordingly( think dynamic difficulty in resident evil 4 )

23
Q

What is an Array

A

A list of something( integers, strings, can be other arrays too)
All information in an array is related

Similar to a grocery list

24
Q

Indexes

A

A numbers “place” in an array

Indexing of arrays begin at 0

25
What is something you can't do with arrays
You cannot change the size an array post, their sizes are final Think of a bookshelf and trying to change its size after the fact
26
What must happen when initializing an array
You must determine its type (String, integer, double, etc) You cannot mix and match arrays
27
What is a 2D Array
Putting an array inside of an array
28
Indexing 2D Arrays
We use 2 numbers, first number is the row, second number is the column
29
Loops
A statement that is meant to run certain instructions repeatedly
30
The For Loop
Used for carrying out a set of instructions numerous times Contains three parts; an integer value, a conditional statement the integer must reach to exit the loop. An operation to modify the integer value after the instructions are completed
31
Infinite loop caution
When making a loop, you must make sure the given initial integer value and the operation will at some point meet. If not an infinite loop will occur and crash your program For(int i = 10; i > 0; i++) { This code will always run because the i integer will always be bigger than zero and will always add 1, therefor causing an infinite loop, as it will never reach zero
32
The For Each Loop
Used for repeating through a list of arrays or lists The loop will go through each element in an array and carry out a set of instructions for each value Useful for performing an operation across an entire collection of data
33
The While Loop
Will continuously carry out its instructions while a conditional statement given is true Can be used to purposely create infinite loops, won't crash your computer While( x < 10)
34
The Do While Loop
A loop that will ALWAYS CARRY OUT ITS INSTRUCTIONS AT LEAST ONCE. Instructions inside loop will run ONCE before checking true or false for a conditional statement
35
Benefit for Loops
Easily perform tasks many time in a row Able to iterate through lists and arrays Decreases clutter in your code ( anti-Yandere dev)
36
What is an error
When code doesn't work as expected, aka bugs
37
Syntaxes Errors
Error that occurs if you fail to meet the programming rules of a language Will usually be highlighted by an IDE
38
Debugging Syntax Errors
IDE's underline syntax errors and usually provide helpful hints Misspelling and grammatical errors basically Strng name = "NullPointerException" :
39
Runtime Error
Caused by a part of your code not being computed within a reasonable amount of time Can be caused by an unintended infinite loop
40
Infinite loop error
Happens if the computer is given a condition with no way to finish that task Puts the computer in error mode and crash due to a never ending condition
41
Preventing runtime errors
You will need to think through the flow of your code before running it Plan out your code before writing
42
Logic Errors
Code runs smoothly, but doesn't give to result you wanted The hardest type to fix, as the error is unknown to the programmer
43
Preventing logic errors
Code small amounts, and test it often. If you don't test often, you might many more logic errors
44
Debugging code
Read the error Transverse to the line of code provided by error Use online forum for help like StackOverflow
45
Breakpoints
Pauses the program when the line you placed the breakpoint at is reached until you continue