What is the term for an instance of a running application?
Process
What keyword in Java is used to prevent multiple threads from running critical code simultaneously?
synchronized
What do you call a shared variable accessed by multiple threads?
Shared Resource
What do we call a 32-bit identifier assigned to a device on a network?
IP Address
In TCP networking, what class does the client use to connect to a server?
Socket
What do we call a lightweight subprocess sharing memory space with other threads?
Thread
What exception must be handled when calling Thread.sleep()?
InterruptedException
What is it called when multiple threads simultaneously modify shared data unpredictably?
Race Condition
What system translates hostnames to IP addresses?
DNS
What Java class waits for incoming TCP connections?
Server Socket
What small unit of time is a thread given by the CPU to execute?
Time Slice
What method allows one thread to wait for another to complete?
join()
What is a code section that accesses shared resources and must not be concurrently executed by multiple threads?
Critical Region
What protocol guarantees reliable, ordered delivery?
TCP
Which UDP class represents a single message to be sent or received?
DatagramPacket
What component decides which process or thread gets CPU time?
Scheduler
What do we call unexpected output due to the unpredictable scheduling of multiple threads?
Interleaving
What three methods allow threads to pause and wait for notifications?
wait(), notify(), notifyAll()
What is the default hostname and ip address for the local machine?
localhost & 127.0.0.1
What design pattern allows a client to call methods on a server as if they were local?
Proxy Pattern
What Java method checks if a thread has started but not finished?
isAlive()
What are the four conditions that must be fulfilled to get a Deadlock?
Mutual Exclusion: A resource is only held by one thread at a time.
Hold and Wait: Threads hold one lock while waiting for another.
No Preemption: Locks can’t be forcibly removed.
Circular Wait: A cycle of threads, each waiting for the next.
In the Producer-Consumer pattern, what method is called if a consumer finds the queue empty? What is called if work is added to the queue?
Consumers call wait() if the queue is empty, Producers call notify() or notifyAll() when work is added.
In networking models, what are the 4 layers of the TCP/IP model?
Application → Transport → Internet → Network Access.
Write code to read & write from a socket stream.
PrintWriter out = new PrintWriter(socket.getOutputStream());
out.println("Hello"); out.flush();
Scanner in = new Scanner(socket.getInputStream());
System.out.println(in.nextLine());