Threading
Threading 2
Networking
Algorithms & Data Structures
Other Units Misc
100

What is a process? 

A program/ instance of an application that is currently being executed by the OS, which may have more than one thread of execution 

100

What is resource contention? 

When multiple threads try to manipulate the value of a shared resource at the same time

100

What are some differences between TCP/IP and UDP? 

TCP is slower & more reliable, sends/receives in a certain tracked order

UDP doesn't require a connection and can deliver even if not all components of the data are complete

100

What is the difference between BFS and DFS?

BFS investigates all surrounding nodes before moving on, DFS utilizes recursion and continues deeper one node at a time

100

What does Observer do?

the concrete observer implements Observer and notify()s when the subject's trigger has been observed

200

What are the 4 thread states?

New, Runnable, Running, Dead

200

What is the difference between extending Thread and implementing Runnable? 

With Thread, the run() method is optional (Runnable has no option but to override it), there is single inheritance, and the subclass technically is a thread. Implementing Runnable is generally better design choice since it is responsible for less and can be restarted. 

200

What are the 4 layers to the DoD/ TCP/IP model?

Application, Transport, Internet, Network Access

200

What are the differences between a heap and BST?

A heap places highest or lowest at top and doesn't care about horizontal order, BST maintains a sorted order where each node's left child is smaller and each right child is larger

200

What'd you do to celebrate Earth day? 

!!!!

300

Why call start() on your thread instance instead of run()? 

run() executes it in the main thread, start() actually executes it in a separate thread

300

Describe join() and sleep()

Join(), used on thread you are waiting for, enforces only proceeding when that thread is finished 

Sleep() is called directly on Thread class to make the calling class relinquish its processor time for the specified ms

300

What do sockets send data as and what do you need to use to make it readable? 

They send streams in bytes or byte arrays, thus we need Scanner and PrintWriter

300

List out all the steps to BFS

As long as queue is not empty and options are not in already-visited set: 

dequeue next vertex and if its not the end then add each of its neighbors to the queue next 

keep checking till path found or queue empty

300

What changes for an inner class if it is declared as static?

It cannot directly access the outer class’ state and behavior, but it can be created without an instance of the outer class

400

What state is a thread in if it is trying to enter a synchronized block of code that another thread currently has the lock on? (And what does it move to after?) 

Blocked until the lock is obtained, then becomes Runnable

400

Why would you generally not put ALL of the contents of your run() method in a synchronized block? 

Then the threads will just run sequentially instead of concurrently; and why are you even using threads at that point bro

400

What is the communication flow between client and server when using TCP

-Server begins listening on a specific port (using accept())

-Client establishes connection on server's port

-Use streams to send/receive data back and forth

400

What data structures does Dijkstra's algorithm use in implementation? 

Map of vertices & their path tuples, and a priority queue for the path tuples

400

When are syntax & runtime errors reported in Java?

Syntax reported when compiled to bytecode, runtime reported at execution

500

In a system called tech booth, there is a lights person, captions person, and sounds person, each representing threads that need two computers each. There are three computers. What would lead to deadlock?

Each person tries to claim one computer and won't give up their lock on it till they do their job with two computers (but cannot ever obtain the second since everyone has one and is waiting on the same thing)

500

In a system called tech booth, there is a lights person, captions person, and sounds person, each representing threads that need two computers each. There are three computers. What would you change about this scenario to make it a producer-consumer system? 

There must be a computer manufacturer, and I suppose the tech booth people break the computers after each use like some sort of maniacs

500

What's the difference between simplex, half-duplex, and full-duplex? (And what are Java sockets?) Optional: How about multiplex?

Simplex is only one direction (and not back)

Half-duplex can be sent both ways but only one at a time

Full duplex can be sent both ways simultaneously, which is what Java sockets are

Multiplex can send multiple streams/signals at once in the form of complex signals 

500

Draw a graph and then diagram traversing it with Nearest Neighbor 

:) Guys I can't input diagrams in answers without paying sorry 

500

Explain and/or diagram the MVC pattern

Model = Application building blocks

View = Current state of the model in viewable form

Controller = Translates actions