Exceptions
I/O
Graphs and BFS
DFS and Backtracking
GUI
100

What type of exception is a ClassCastException and when does it occur?

A ClassCastException is a Runtime Exception and it occurs when an object cast into another object that the object isn't.

100

What are the four types of I/O?

Reader and Writer and InputStream and OutputStream.

100

What is BFS always guaranteed to find?

The shortest path.

100

What is the vocab term to describe removing invalid configurations to improve runtime?

Pruning
100

Will you have to know how a GUI tree thing works on the exam?

Definitely.

Stage -> Scene -> Node

Pretty much every javaFX item extends Node.

 - Pane, Button, Text, ImageView <- these are the ones yall use in this course

- Panes have more nodes in them.

- Keep going down the tree until all leaf nodes have nodes that aren't panes

200

What is the difference between a Runtime Exception and a Checked Exception?

A runtime exception doesn't have to be caught or thrown explicitly in the syntax and is an Unchecked Exception.

200

What is a decorator pattern?

When an object takes in another object to expand its functionality.  

200

What data structure does a BFS use?

A Queue

200

What are the two parts of the getSucessors function?

1. Deep copying all information into a new configuration

2. Modifying the information in the new configuration

200

What method is used to run the GUI and what order of methods are called after that?

Application.launch(args);

init, start, close


300

What is the syntax to throw an Exception with the message "sup".

300

Write the line of code to create a PrintWriter to System.out. If you can also make it so the PrintWriter auto flushes when it encounters a new line then you get double points.

PrintWriter pw = new PrintWriter(System.out, true);

300

Is a binary search tree a graph? If so, what kind of graph? 

Directed Acyclic Graph

300

Time complexity of BFS, DFS, and Backtracking

BFS/ DFS: O(|V|+|E|)

Backtracking: O(2^N)

Backtracking: O(|S|^N) where S is the set of successors for each node.

300

Which methods do you call to set the elements of a BorderPane?

setTop, setLeft, setCenter, setRight, setBottom

400

What is the difference between an Error and an Exception?

An Error shouldn't normally be handled. They can be handled just like Exceptions, except they probably shouldn't because it is very difficult to recover from and it isn't a hundred percent sure when they occur.

400
Create a BufferedReader that reads from System.in.

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

400

What are two ways in class to represent a graph?

Adjacency List, Adjacency Matrix, Edge List

400

What are the 3 functions that the Configuration Interface declares?

boolean isValid();

Collection<Configuration> getSucessors();

boolean isGoal();

400

Write the code that when a button is clicked then the function runButton is called.

button.setOnAction(e -> {

runButton();

});

500

What is the output of this function?

500

Why did you learn IO and exceptions in the same week?

IOExceptions are often thrown when working with IO and IOExceptions are Checked Exceptions. It is impossible to learn IO without first learning Checked Exceptions.

500

Run a BFS and DFS algorithm on this graph starting at node d. When visiting a neighbor go in alphabetical order.

BFS: d, c, e, a, b, f, g

DFS: d, c, a, b, f, g, e

500

Daily Double:

What is the minumum amount of lines of code that needs to be changed to turn this code into DFS. Also for that line what is the change that needs to be made?

2 lines of code:

Line 189: Stack<NodeType> toGetNeighbors = new Stack<>();

Line 193: NodeType current = toGetNeighbors.pop();

500

Which tier usually creates the model tier and why?

The View Tier, because it needs to add itself as an Observer.

M
e
n
u