Q1. What is a compiler? Explain its phases.
A compiler is a program that translates high-level source code into machine code. The phases of a compiler
are:
1. Lexical Analysis
2. Syntax Analysis
3. Semantic Analysis
4. Intermediate Code Generation
5. Code Optimization
6. Target Code Generation
7. Error Handling & Symbol Table Management.
Q2. Define Deadlock.
A deadlock is a situation in an operating system where a set of processes are blocked because each process
is holding a resource and waiting for another resource acquired by some other process.
Q3. What is a Data Structure?
A data structure is a way of organizing data so that it can be used efficiently. Examples include arrays, linked
lists, stacks, queues, trees, and graphs.
Q4. Explain the difference between TCP and UDP.
TCP (Transmission Control Protocol) is connection-oriented and reliable, while UDP (User Datagram
Protocol) is connectionless and faster but unreliable.