mode 1 Flashcards

1
Q

What is an array?

A

It’s a series of data entries (of the same datatype). Sequential in memory. Also, you can’t change the size of an array. (You could also describe it as a “group” or “matrix”, but NOT a list, set or collection)

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

How do I create an array?

A

int[] arry1 = new int[95]; //95 elements in this array
int[] arry2 = {5, 7, 19}; //3 elements in this array

int arry3[] = {1, 66, 120, 5};
int arry4[]= new int[]{4,1,5};

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

What happens when I take a look at an uninitialized element?

A

We see the default values of the give datatype:
int is 0,
double is 0.0D,
float is 0.0F,
short is 0, long is 0L, boolean is false, byte is 0, char is “empty character”,

Objects of any type default to “null”

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

WHAT is the heap?

A

The heap is the allowable memory space your operating systems gives you for your program’s runtime

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

WHAT is the stack?

A

The stack is a structured memory space inside of the heap used to keep track of the program’s order of operations (the flow of execution).. It’ll contain things like method calls, local variables, etc (NOT object and arrays)
>a stack is last in first out (LIFO) aka first in last out (FILO)
>a stack is like a stack of pancakes, the last pancake you put on your plate is also the first pancake you eat

> Use case: for a stack, you may want to use a stack if you’re creating an “undo” and “redo” functionality

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

What….is the counterpart to a stack?

A

Queue is the counterpart of a stack.
>a queue is first in first out (FIFO) or (LILO)
>a queue is like the line at the DMV, when you’re first in line you’re also the first to be serviced
> Use case: for a queue, you may want to use a queue if you’re keeping track of some transactions in an application

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

What is a data structure?

A

A data structure is an object in programming that is designed to store a large group of data entries.
>
>for example, there are: linked lists, array lists, binary trees, maps, etc.

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

Why do we use data structures

A

We use data structures to create efficiency and organization in storing large groups of data entries. It’s like having your toys scattered around your room OR having a toy box.
>there are MANY different types of data structures out there (and you can even invent more if you’d like); each with their own pros and cons.

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

What are modifiers?

A

A keyword used to modify the functionality of the method (not just the access level, like most initial think)

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

Types of modifiers?

A

public, protected, private, static, final, default, synchronized, transient, abstract, etc

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

What is wrong with redundant code?

A

Maintainability issue: the code has far more lines than necessary, the code is bloated and takes more time to update the code base

Readability issue: promotes update anomalies aka if you accidentally miss one (or more) of the updates

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

What is modularization?

A

Modularization is how we defeat redundancy

The process of creating a module of reusable functionality. for example, creating a method out of functionality instead of copying and pasting

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