What is an Array?
A list of elements with a fixed size and elements.
What is a For Loop?
A statement that iterates the block of code inside it for a set number of times.
What is another name for Non-primitve Data Types?
Reference data types.
A stack is a first in last out (FILO) data structure. Imagine a stack of plates; the first plate put in the pile is the last one retrieved.
What is an ArrayList?
A better version of the Array with more flexibility.
What is a For Each Loop? Also called an Enhanced For Loop.
For each loops will iterate through elements in arrays or collections making it easier to loop through these data structures without needing the indexes.
How many Primitive Data Types are in Java?
There are 8 Primitive Data Types
What is the skeleton code for a class?
public class {
public static void main(String[] args){
}
}
What is a queue?
What are the differences between Arrays and ArrayLists?
Arrays have a fixed size while ArrayLists don't. You can add elements to ArrayLists but you can't with Arrays after being declared.
What is a Nested For Loop?
A Loop statement inside another Loop statement. Can be used to get information about multidimension data structures such as 2D arrays and 3D arrays.
What are Primitive Data Types?
Predefined data types that specify the size and type of the data that can be stored. For example, a byte has a value range of -128 to 127 and nothing outside of that range. These data types are not objects.
If I create a class without a constructor and I try to create an object in my main class, what would happen? Would I get an runtime error, a syntax error, or no errors?
No errors; Java provides a default constructor when you create an object.
What is a Node (in general for all data structures)?
A node is something that contains value(s) and pointer(s) to other nodes. It's used in most data structures such as Linked List, Queue, Stack, and Binary Search Tree.
What is an example of a method related to ArrayLists?
listName.add("value");
listName.get(0);
listName.set(0,"newValue");
What is a While Loop?
A loop that will iterate forever until a condition is met, can be thought as a repeated if statement.
What is an example of a Non-primitive Data Type?
How many objects can you have in a class?
No limit as long as you have the memory for it.
What's a HashMap?
A HashMap is a data structure that each piece of data entered can be retrieved by a key (key-value relationship). Imagine a library. You can retrieve a book if you know its title.
What data type are elements in ArrayLists?
What is a Do While Loop?
Similar to a While Loop but it will always do one iteration even if the condition is already met. This is due to the condition being checked after the iteration.
What is a difference between Primitive and Non-Primitive Data Types?
Primitive - Pre-defined Data Types
Non-Primitive - User-defined Data Types
What is Polymorphism?
Many versions of one method that is reused in different classes. Works with Inheritance for this to work.
What's the difference between Time Complexity and Space Complexity?
Time complexity is how long the function takes to complete in relation to its input size.
for(int i = 0; i < n; i++)
for(j = 0; j < n; j++)
System.out.println(i+j);
This would have a time complexity of O(n^2) because the function will n^2 iterations.
Space Complexity is how much memory a function needs in relation to it's input size.
int[] flags = new int[n*n*n];
This would have a space complexity of O(n^3) because the array takes up n^3 spaces of memory.